<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=1.0, user-scalable=0">
    <title>四柱八字排盘</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            -webkit-box-sizing: border-box;
            -moz-box-sizing: border-box;
            -ms-box-sizing: border-box;
            -o-box-sizing: border-box;
            box-sizing: border-box;
            outline: none
        }

        html {
            font-size: 18px;
            font-family: "Microsoft Yahei", "Helvetica Neue", Helvetica, Arial, sans-serif;
            font-style: normal;
        }

        body {
            background-color: #fff;
            padding: 5px;
        }

        h1 {
            font-size: 28px;
            font-weight: normal;
            color: #0a0a0a;
            border-bottom: 1px solid #373737;
            padding: 5px 0;
        }

        #input {
            margin-top: 5px;
            font-size: 18px;
            float: left;
            width: 360px;
            height: 120px;
            padding: 5px;
        }

        .condition {
            float: left;
            padding: 5px;
        }

        .error {
            border-color: red
        }

        table {
            margin: 2px;
            clear: both;
            display: block;
            border-collapse: collapse;
            empty-cells: show;
            border: 0;
        }

        td {
            padding: 4px;
            text-align: center;
            white-space: nowrap;
        }

        td.left {
            text-align: left;
        }

        td.bazi {
            font-size: 22px;
            font-weight: bold;
        }

        td.bold {
            font-weight: bold;
        }

        td.small {
            font-size: 14px;
        }

        .tip {
            clear: both;
            margin-top: 10px;
            font-size: 13px;
            color: #373737;
            white-space: normal;
        }

        .red {
            color: #c40000;
        }

        @media (max-width: 900px) {
            html {
                font-size: calc(100vw/7.5);
            }

            body {
                padding: 0.05rem;
            }

            h1 {
                font-size: 0.32rem;
            }

            #input {
                width: 100%;
                height: 1rem;
                padding: 0.1rem;
                font-size: 0.36rem;
            }

            .condition {
                padding: 0.2rem;
                font-size: 0.28rem;
            }

            td {
                padding: 0.04rem;
                font-size: 0.28rem;
            }

            td.bazi {
                font-size: 0.34rem;
            }

            td.small {
                font-size: 0.21rem;
            }

            td.hide {
                font-size: 0;
                width: 0;
                padding: 0;
            }

            .tip {
                margin-top: 0.1rem;
                font-size: 0.24rem;
            }

            /* add by dachuan */

            .birthAdd{
                font-size: 0.32rem;
            }

            #location{
                font-size: 0.32rem;
            }

            #btn_go{
                font-size: 0.32rem;
                float: right;
            }
        }

        /*
        .birthAdd{
            font-size: 28px;
        }

        #location{
            font-size: 28px;
        }
        */
    </style>
</head>

<body>
    <h1>四柱八字排盘</h1>
    <textarea id="input"></textarea>
    <div class="condition">
        <label><input id="gender_man" type="radio" name="gender" value="+" checked>男</label>
        <label><input id="gender_woman" type="radio" name="gender" value="-">女</label>
        <label><input type="checkbox" id="lunar">阴历</label>
        <label><input id="zi0" type="radio" name="zi" value="2">当日明时</label>
        <label><input id="zi1" type="radio" name="zi" value="1" checked>明日明时</label>
        <div class="birthAdd">出生地: <input id="location" type="text" name="location"  value="上海市"></div>
        <button id="btn_go"> 立即排盘 </button>
        <div class="tip">录入一段日期信息到框中，如199908121700-，代表1999年8月12日17点生女。<br>1. +表示男，-表示女。<br>2. 三个连续空格表示阴历。<br>3. 月前有空格表示闰月，非闰月不生效。<br>4. 时间跨度支持：0001(庚申年)至9999(己亥年)。<br>5. 真太阳时支持：出生地填入xx省xx市，默认上海，暂不支持海外。 </div>
    </div>

    <div id="pan"></div>
    <script src="lunar.js"></script>
    <script>
        (function(W, D) {
            var setClass = function(el, v) {
                try {
                    el.className = v;
                } catch (e) {
                    el.setAttribute('class', v);
                }
            };
            var trim = function(s) {
                return s.replace(/(^\s*)|(\s*$)/g, '');
            };
            var padding = function(n) {
                return (n < 10 ? '0' : '') + n;
            };
            var selectSect = 1;
            var input = D.getElementById('input');
            var locationAddress = D.getElementById('location'); //by dachuan
            var go_btn = D.getElementById('btn_go'); //by dachuan
            var genderMan = D.getElementById('gender_man');
            var genderWoman = D.getElementById('gender_woman');
            var zi0 = D.getElementById('zi0');
            var zi1 = D.getElementById('zi1');
            var lunarCheck = D.getElementById('lunar');
            var result = D.getElementById('pan');

            var onChangeGender = function() {
                var v = input.value;
                var gender = genderMan.checked ? '+' : '-';
                if (/[+-]$/.test(v)) {
                    v = v.replace(/[+-]/g, gender);
                } else {
                    v = v + gender;
                }
                input.value = v;
                //onInput();
            };

            var onChangeZi = function() {
                selectSect = zi1.checked ? 1 : 2;
                //onInput();
            };

            var onChangeLunar = function() {
                var v = input.value;
                if (/\s{3}/.test(v)) {
                    v = v.replace(/\s{3}/g, '');
                } else {
                    v = '   ' + v;
                }
                input.value = v;
                //onInput();
            };

            var onInput = function() {
                var v = input.value;
                if (!/^\s*\d{4}\s*\d{2}\s*\d{2}\s*\d{2}\s*\d{2}\s*[+-]?$/.test(v)) {
                    setClass(input, 'error');
                    return;
                }
                lunarCheck.checked = /\s{3}/.test(v) ? 'checked' : '';

                // 加入真太阳时计算
                v = trim(v);
                console.log('this v: ', v);
                const g = v[v.length -1]; //最后一位性别
                const timeStr = v.substring(0,v.length -1);
                const locationStr = locationAddress.value;

                // 区分阴历与阳历
                var realV = "";
                if (lunarCheck.checked){
                    const tlist = timeStrSplitter(timeStr);
                    const lunarDay = Lunar.fromYmdHms(tlist[0], tlist[1], tlist[2], tlist[3], tlist[4], 0);
                    const solarDay = lunarDay.getSolar();    
                    const sYear = solarDay.getYear();
                    const sMonth = solarDay.getMonth();
                    const sDay = solarDay.getDay();
                    const sHour = solarDay.getHour();
                    const sMinute = solarDay.getMinute();
                    const sTimeStr = String(sYear) + String(sMonth) + String(sDay) + String(sHour) + String(sMinute);
                    //realV = await getSolarRealTime(sTimeStr,locationStr);
                    //getSolarRealTime(sTimeStr,locationStr).then(r => realV = "   " + r + g);

                    getSolarRealTime(timeStr,locationStr).then(r => {
                                realV ="   " + r + g;
                                console.log(realV);
                                compute(realV);
                            });
                }
                else{
                    //realV = await getSolarRealTime(timeStr,locationStr);
                    getSolarRealTime(timeStr,locationStr).then(r => {
                                realV =  r + g;
                                console.log(realV);
                                compute(realV);
                            });
                }
                
                setClass(input, '');
            };

            function timeStrSplitter(timeString){
                const year = Number(timeString.substr(0, 4));
                const month = Number(timeString.substr(4, 2));
                const day = Number(timeString.substr(6, 2));
                const hours = Number(timeString.substr(8, 2));
                const minutes = Number(timeString.substr(10, 2));
                return [year,month,day,hours,minutes]
            }


            async function getSolarRealTime(localTimeStr, locationAddressStr){
            
                async function getLongitude(locationAddressStr) {
                  try {
                    // 调用高德接口
                    // 通过地址查询经纬度
                    const apiKey = "1928e7a2f30279fc9cb4690d191461d4";
                    const url = `https://restapi.amap.com/v3/geocode/geo?address=${encodeURIComponent(locationAddressStr)}&output=JSON&key=${apiKey}`;
            
                    // 发起请求，获取地理坐标
                    const response = await fetch(url);
                    const data = await response.json();
            
                    if (data["info"] !== "OK") {
                      throw new Error(`Failed to get longitude for location ${locationAddressStr}`);
                    }
            
                    // 解析经度值
                    const location = data.geocodes[0].location;
                    const longitude = Number(location.split(",")[0]);
                    return longitude;
                  } catch (error) {
                    throw error; // 抛出异常，拒绝该Promise对象
                  }
                }
            
                function constructTime(timeString) {
                    /* 通过yyyymmddhhmm 来构造一个date对象
                     * 便于标准计算
                     * */
                    const year = Number(timeString.substr(0, 4));
                    const month = Number(timeString.substr(4, 2)) - 1;
                    const day = Number(timeString.substr(6, 2));
                    const hours = Number(timeString.substr(8, 2));
                    const minutes = Number(timeString.substr(10, 2));
                    
                    const localTime = new Date(year, month, day, hours, minutes);
                    
                    return localTime;
                }
            
                function outputTimeStr(realTime){
                    /* 
                     * 将date对象转化成yyyymmddhhmm的形式
                     */
                    const year = realTime.getFullYear();
                    const month = String(realTime.getMonth() + 1).padStart(2, '0'); // 月份从0开始，需要加1
                    const date = String(realTime.getDate()).padStart(2, '0');
                    const hour = String(realTime.getHours()).padStart(2, '0');
                    const minute = String(realTime.getMinutes()).padStart(2, '0');
                    const timeString = year + month + date + hour + minute;
            
                    return timeString;
                }
            
                //const longitude = 139.6503;
                const longitude = await getLongitude(locationAddressStr);
                
                // 将standardTimeStr转换为Date对象
                const localTime = constructTime(localTimeStr);
            
                // 计算时间偏移量
                // 以东八区北京时间为标准
                const timeDiff = (longitude - 120) * 4 * 60 * 1000; // 经度与标准经度的差值，每度经度相当于4分钟的时间差，单位为毫秒
            
                // 计算真实太阳时的时间戳
                const localTimeTimestamp = localTime.getTime();
                const trueSolarTimeTimestamp = localTimeTimestamp + timeDiff;
            
                // 将真实太阳时的时间戳转换为本地时间
                const realTime = new Date(trueSolarTimeTimestamp);
            
                const realTimeStr = outputTimeStr(realTime);
                return realTimeStr;
            }


            var CHANG_SHENG_OFFSET = {
                '甲': 1,
                '丙': 10,
                '戊': 10,
                '庚': 7,
                '壬': 4,
                '乙': 6,
                '丁': 9,
                '己': 9,
                '辛': 0,
                '癸': 3
            };

            function getChangSheng(gan, ganIndex, zhiIndex) {
                var offset = CHANG_SHENG_OFFSET[gan];
                var index = offset + (ganIndex % 2 == 0 ? zhiIndex : -zhiIndex);
                if (index >= 12) {
                    index -= 12;
                }
                if (index < 0) {
                    index += 12;
                }
                return EightChar.CHANG_SHENG[index];
            }

            function getGanIndex(gan) {
                for (var i = 0, j = LunarUtil.GAN.length; i < j; i++) {
                    if (gan === LunarUtil.GAN[i]) {
                        return i - 1;
                    }
                }
                return 0;
            }

            function getZhiIndex(zhi) {
                for (var i = 0, j = LunarUtil.ZHI.length; i < j; i++) {
                    if (zhi === LunarUtil.ZHI[i]) {
                        return i - 1;
                    }
                }
                return 0;
            }

            var computeEightChar = function(lunar, solar, gender) {
                var bazi = lunar.getEightChar();
                // 选择流派
                bazi.setSect(selectSect);
                var currentYear, startYunSolar, daYun, daYunSize, currentYun;
                if (-1 != gender) {
                    var date = new Date();
                    currentYear = date.getFullYear();
                    var yun = bazi.getYun(gender);
                    startYunSolar = yun.getStartSolar();
                    daYun = yun.getDaYun();
                    daYunSize = daYun.length;
                    var currentLunar = Lunar.fromDate(date);

                    var yZhi = currentLunar.getYearZhiByLiChun();
                    var yHideGan = LunarUtil.ZHI_HIDE_GAN[yZhi];
                    var yShiShenZhi = [];
                    for (var u = 0, v = yHideGan.length; u < v; u++) {
                        yShiShenZhi.push(yHideGan[u] + '-' + LunarUtil.SHI_SHEN_ZHI[bazi.getDayGan() + yZhi + yHideGan[u]]);
                    }

                    var mZhi = currentLunar.getMonthZhi();
                    var mHideGan = LunarUtil.ZHI_HIDE_GAN[mZhi];
                    var mShiShenZhi = [];
                    for (var u = 0, v = mHideGan.length; u < v; u++) {
                        mShiShenZhi.push(mHideGan[u] + '-' + LunarUtil.SHI_SHEN_ZHI[bazi.getDayGan() + mZhi + mHideGan[u]]);
                    }

                    var rZhi = currentLunar.getDayZhi();
                    var rHideGan = LunarUtil.ZHI_HIDE_GAN[rZhi];
                    var rShiShenZhi = [];
                    for (var u = 0, v = rHideGan.length; u < v; u++) {
                        rShiShenZhi.push(rHideGan[u] + '-' + LunarUtil.SHI_SHEN_ZHI[bazi.getDayGan() + rZhi + rHideGan[u]]);
                    }

                    var sZhi = currentLunar.getTimeZhi();
                    var sHideGan = LunarUtil.ZHI_HIDE_GAN[sZhi];
                    var sShiShenZhi = [];
                    for (var u = 0, v = sHideGan.length; u < v; u++) {
                        sShiShenZhi.push(sHideGan[u] + '-' + LunarUtil.SHI_SHEN_ZHI[bazi.getDayGan() + sZhi + sHideGan[u]]);
                    }

                    currentYun = {
                        daYunWuXing: '',
                        liuNianWuXing: LunarUtil.WU_XING_GAN[currentLunar.getYearGanByLiChun()] + LunarUtil.WU_XING_ZHI[currentLunar.getYearZhiByLiChun()],
                        liuYueWuXing: LunarUtil.WU_XING_GAN[currentLunar.getMonthGan()] + LunarUtil.WU_XING_ZHI[currentLunar.getMonthZhi()],
                        liuRiWuXing: LunarUtil.WU_XING_GAN[currentLunar.getDayGan()] + LunarUtil.WU_XING_ZHI[currentLunar.getDayZhi()],
                        liuShiWuXing: LunarUtil.WU_XING_GAN[currentLunar.getTimeGan()] + LunarUtil.WU_XING_ZHI[currentLunar.getTimeZhi()],

                        daYunDiShi: '',
                        liuNianDiShi: getChangSheng(bazi.getDayGan(), bazi.getDayGanIndex(), currentLunar.getYearZhiIndexByLiChun()),
                        liuYueDiShi: getChangSheng(bazi.getDayGan(), bazi.getDayGanIndex(), currentLunar.getMonthZhiIndex()),
                        liuRiDiShi: getChangSheng(bazi.getDayGan(), bazi.getDayGanIndex(), currentLunar.getDayZhiIndex()),
                        liuShiDiShi: getChangSheng(bazi.getDayGan(), bazi.getDayGanIndex(), currentLunar.getTimeZhiIndex()),

                        daYunChangSheng: '',
                        liuNianChangSheng: getChangSheng(currentLunar.getYearGanByLiChun(), currentLunar.getYearGanIndexByLiChun(), currentLunar.getYearZhiIndexByLiChun()),
                        liuYueChangSheng: getChangSheng(currentLunar.getMonthGan(), currentLunar.getMonthGanIndex(), currentLunar.getMonthZhiIndex()),
                        liuRiChangSheng: getChangSheng(currentLunar.getDayGan(), currentLunar.getDayGanIndex(), currentLunar.getDayZhiIndex()),
                        liuShiChangSheng: getChangSheng(currentLunar.getTimeGan(), currentLunar.getTimeGanIndex(), currentLunar.getTimeZhiIndex()),

                        daYunXunKong: '',
                        liuNianXunKong: LunarUtil.getXunKong(currentLunar.getYearInGanZhiByLiChun()),
                        liuYueXunKong: LunarUtil.getXunKong(currentLunar.getMonthInGanZhi()),
                        liuRiXunKong: LunarUtil.getXunKong(currentLunar.getDayInGanZhi()),
                        liuShiXunKong: LunarUtil.getXunKong(currentLunar.getTimeInGanZhi()),

                        daYunNaYin: '',
                        liuNianNaYin: LunarUtil.NAYIN[currentLunar.getYearInGanZhiByLiChun()],
                        liuYueNaYin: LunarUtil.NAYIN[currentLunar.getMonthInGanZhi()],
                        liuRiNaYin: LunarUtil.NAYIN[currentLunar.getDayInGanZhi()],
                        liuShiNaYin: LunarUtil.NAYIN[currentLunar.getTimeInGanZhi()],

                        daYunShiShen: '',
                        daYunShiShenZhi: [],
                        liuNianGanZhi: currentLunar.getYearInGanZhiByLiChun(),
                        liuNianShiShen: LunarUtil.SHI_SHEN_GAN[bazi.getDayGan() + currentLunar.getYearGanByLiChun()],
                        liuNianShiShenZhi: yShiShenZhi,
                        liuYueGanZhi: currentLunar.getMonthInGanZhi(),
                        liuYueShiShen: LunarUtil.SHI_SHEN_GAN[bazi.getDayGan() + currentLunar.getMonthGan()],
                        liuYueShiShenZhi: mShiShenZhi,
                        liuRiGanZhi: currentLunar.getDayInGanZhi(),
                        liuRiShiShen: LunarUtil.SHI_SHEN_GAN[bazi.getDayGan() + currentLunar.getDayGan()],
                        liuRiShiShenZhi: rShiShenZhi,
                        liuShiGanZhi: currentLunar.getTimeInGanZhi(),
                        liuShiShiShen: LunarUtil.SHI_SHEN_GAN[bazi.getDayGan() + currentLunar.getTimeGan()],
                        liuShiShiShenZhi: sShiShenZhi
                    };
                    currentYun.liuNianGan = currentYun.liuNianGanZhi.substr(0, 1);
                    currentYun.liuNianZhi = currentYun.liuNianGanZhi.substr(1);
                    currentYun.liuYueGan = currentYun.liuYueGanZhi.substr(0, 1);
                    currentYun.liuYueZhi = currentYun.liuYueGanZhi.substr(1);
                    currentYun.liuRiGan = currentYun.liuRiGanZhi.substr(0, 1);
                    currentYun.liuRiZhi = currentYun.liuRiGanZhi.substr(1);
                    currentYun.liuShiGan = currentYun.liuShiGanZhi.substr(0, 1);
                    currentYun.liuShiZhi = currentYun.liuShiGanZhi.substr(1);

                    for (var i = 0; i < daYunSize; i++) {
                        var d = daYun[i];
                        if (d.getStartYear() <= currentYear && currentYear <= d.getEndYear()) {
                            var gz = d.getGanZhi();
                            if (gz) {
                                var g = gz.substr(0, 1);
                                var z = gz.substr(1);
                                var zIndex = getZhiIndex(z);
                                currentYun.daYunWuXing = LunarUtil.WU_XING_GAN[g] + LunarUtil.WU_XING_ZHI[z];
                                currentYun.daYunDiShi = getChangSheng(bazi.getDayGan(), bazi.getDayGanIndex(), zIndex);
                                currentYun.daYunChangSheng = getChangSheng(g, getGanIndex(g), zIndex);
                                currentYun.daYunXunKong = LunarUtil.getXunKong(gz);
                                currentYun.daYunNaYin = LunarUtil.NAYIN[gz];

                                currentYun.daYunGan = g;
                                currentYun.daYunZhi = z;
                                currentYun.daYunGanZhi = gz;
                                currentYun.daYunShiShen = LunarUtil.SHI_SHEN_GAN[bazi.getDayGan() + g];
                                var dHideGan = LunarUtil.ZHI_HIDE_GAN[z];
                                var dShiShenZhi = [];
                                for (var x = 0, y = dHideGan.length; x < y; x++) {
                                    dShiShenZhi.push(dHideGan[x] + '-' + LunarUtil.SHI_SHEN_ZHI[bazi.getDayGan() + z + dHideGan[x]]);
                                }
                                currentYun.daYunShiShenZhi = dShiShenZhi;
                            }
                            break;
                        }
                    }
                }
                var s = '<table><tbody>';
                s += '<tr>';
                s += '<td>出生：</td>';
                s += '<td colspan="10" class="left small">' + solar.getYear() + '年' + solar.getMonth() + '月' + solar.getDay() + '日(' + lunar.getMonthInChinese() + '月' + lunar.getDayInChinese() + ')' + padding(solar.getHour()) + ':' + padding(solar.getMinute()) + ' 星期' + solar.getWeekInChinese() + '生肖' + lunar.getYearShengXiao() + solar.getXingZuo() + '座</td>';
                s += '</tr>';

                s += '<tr>';
                s += '<td>节气：</td>';
                var prevJieQi = lunar.getPrevJie();
                var jieQiSolar = prevJieQi.getSolar();
                s += '<td colspan="10" class="left small">' + prevJieQi.getName() + '：' + jieQiSolar.getMonth() + '月' + jieQiSolar.getDay() + '日' + padding(jieQiSolar.getHour()) + ':' + padding(jieQiSolar.getMinute()) + '；';
                var nextJieQi = lunar.getNextJie();
                jieQiSolar = nextJieQi.getSolar();
                s += nextJieQi.getName() + '：' + jieQiSolar.getMonth() + '月' + jieQiSolar.getDay() + '日' + padding(jieQiSolar.getHour()) + ':' + padding(jieQiSolar.getMinute());
                s += '</td>';
                s += '</tr>';

                var riGan = '日干';
                var baziTitle = '八字';
                var daYunTitle = '大运';
                var liuNianTitle = '流年';
                var liuYueTitle = '流月';
                var liuRiTitle = '流日';
                var liuShiTitle = '流时';
                if (1 == gender) {
                    baziTitle = '乾造';
                    riGan = '元男';
                } else if (0 == gender) {
                    baziTitle = '坤造';
                    riGan = '元女';
                } else {
                    daYunTitle = '';
                    liuNianTitle = '';
                    liuYueTitle = '';
                    liuRiTitle = '';
                }
                s += '<tr>';
                s += '<td rowspan="4" valign="top">' + baziTitle + '：</td>';
                s += '<td>年柱</td>';
                s += '<td>月柱</td>';
                s += '<td>日柱</td>';
                s += '<td>时柱</td>';

                s += '<td>' + daYunTitle + '</td>';
                s += '<td>' + liuNianTitle + '</td>';
                s += '<td>' + liuYueTitle + '</td>';
                s += '<td>' + liuRiTitle + '</td>';
                s += '<td>' + liuShiTitle + '</td>';
                s += '<td colspan="2"></td>';
                s += '</tr>';
                s += '<tr>';
                s += '<td class="small">' + bazi.getYearShiShenGan() + '</td>';
                s += '<td class="small">' + bazi.getMonthShiShenGan() + '</td>';
                s += '<td class="small red">' + riGan + '</td>';
                s += '<td class="small">' + bazi.getTimeShiShenGan() + '</td>';
                if (currentYun) {

                    s += '<td class="small">' + currentYun.daYunShiShen + '</td>';
                    s += '<td class="small">' + currentYun.liuNianShiShen + '</td>';
                    s += '<td class="small">' + currentYun.liuYueShiShen + '</td>';
                    s += '<td class="small">' + currentYun.liuRiShiShen + '</td>';
                    s += '<td class="small">' + currentYun.liuShiShiShen + '</td>';
                    s += '<td colspan="2"></td>';
                } else {
                    s += '<td colspan="6"></td>';
                }
                s += '</tr>';
                s += '<tr>';
                s += '<td class="bazi">' + bazi.getYearGan() + '<br>' + bazi.getYearZhi() + '</td>';
                s += '<td class="bazi">' + bazi.getMonthGan() + '<br>' + bazi.getMonthZhi() + '</td>';
                s += '<td class="bazi">' + bazi.getDayGan() + '<br>' + bazi.getDayZhi() + '</td>';
                s += '<td class="bazi">' + bazi.getTimeGan() + '<br>' + bazi.getTimeZhi() + '</td>';
                if (currentYun) {

                    s += '<td class="bazi">' + (currentYun.daYunGanZhi ? (currentYun.daYunGanZhi.substr(0, 1) + '<br>' + currentYun.daYunGanZhi.substr(1)) : '') + '</td>';
                    s += '<td class="bazi">' + currentYun.liuNianGanZhi.substr(0, 1) + '<br>' + currentYun.liuNianGanZhi.substr(1) + '</td>';
                    s += '<td class="bazi">' + currentYun.liuYueGanZhi.substr(0, 1) + '<br>' + currentYun.liuYueGanZhi.substr(1) + '</td>';
                    s += '<td class="bazi">' + currentYun.liuRiGanZhi.substr(0, 1) + '<br>' + currentYun.liuRiGanZhi.substr(1) + '</td>';
                    s += '<td class="bazi">' + currentYun.liuShiGanZhi.substr(0, 1) + '<br>' + currentYun.liuShiGanZhi.substr(1) + '</td>';
                    s += '<td colspan="2"></td>';
                } else {
                    s += '<td colspan="6"></td>';
                }
                s += '</tr>';
                s += '<tr>';
                var hideGan = bazi.getYearHideGan();
                var shiShenZhi = bazi.getYearShiShenZhi();
                s += '<td valign="top" class="small">';
                for (var i = 0, j = hideGan.length; i < j; i++) {
                    s += '<div' + (i == 0 ? ' class="red"' : '') + '>'
                    s += hideGan[i] + '-' + shiShenZhi[i];
                    s += '</div>';
                }
                s += '</td>';
                hideGan = bazi.getMonthHideGan();
                shiShenZhi = bazi.getMonthShiShenZhi();
                s += '<td valign="top" class="small">';
                for (var i = 0, j = hideGan.length; i < j; i++) {
                    s += '<div' + (i == 0 ? ' class="red"' : '') + '>'
                    s += hideGan[i] + '-' + shiShenZhi[i];
                    s += '</div>';
                }
                s += '</td>';
                hideGan = bazi.getDayHideGan();
                shiShenZhi = bazi.getDayShiShenZhi();
                s += '<td valign="top" class="small">';
                for (var i = 0, j = hideGan.length; i < j; i++) {
                    s += '<div' + (i == 0 ? ' class="red"' : '') + '>'
                    s += hideGan[i] + '-' + shiShenZhi[i];
                    s += '</div>';
                }
                s += '</td>';
                hideGan = bazi.getTimeHideGan();
                shiShenZhi = bazi.getTimeShiShenZhi();
                s += '<td valign="top" class="small">';
                for (var i = 0, j = hideGan.length; i < j; i++) {
                    s += '<div' + (i == 0 ? ' class="red"' : '') + '>'
                    s += hideGan[i] + '-' + shiShenZhi[i];
                    s += '</div>';
                }
                s += '</td>';
                if (currentYun) {

                    s += '<td class="small" valign="top">';
                    for (var i = 0, j = currentYun.daYunShiShenZhi.length; i < j; i++) {
                        s += '<div' + (i == 0 ? ' class="red"' : '') + '>'
                        s += currentYun.daYunShiShenZhi[i];
                        s += '</div>';
                    }
                    s += '</td>';
                    s += '<td class="small" valign="top">';
                    for (var i = 0, j = currentYun.liuNianShiShenZhi.length; i < j; i++) {
                        s += '<div' + (i == 0 ? ' class="red"' : '') + '>'
                        s += currentYun.liuNianShiShenZhi[i];
                        s += '</div>';
                    }
                    s += '</td>';
                    s += '<td class="small" valign="top">';
                    for (var i = 0, j = currentYun.liuYueShiShenZhi.length; i < j; i++) {
                        s += '<div' + (i == 0 ? ' class="red"' : '') + '>'
                        s += currentYun.liuYueShiShenZhi[i];
                        s += '</div>';
                    }
                    s += '</td>';
                    s += '<td class="small" valign="top">';
                    for (var i = 0, j = currentYun.liuRiShiShenZhi.length; i < j; i++) {
                        s += '<div' + (i == 0 ? ' class="red"' : '') + '>'
                        s += currentYun.liuRiShiShenZhi[i];
                        s += '</div>';
                    }
                    s += '</td>';
                    s += '<td class="small" valign="top">';
                    for (var i = 0, j = currentYun.liuShiShiShenZhi.length; i < j; i++) {
                        s += '<div' + (i == 0 ? ' class="red"' : '') + '>'
                        s += currentYun.liuShiShiShenZhi[i];
                        s += '</div>';
                    }
                    s += '</td>';
                    s += '<td colspan="2"></td>';
                } else {
                    s += '<td colspan="6"></td>';
                }
                s += '</tr>';

                s += '<tr>';
                s += '<td>纳音：</td>';
                s += '<td class="small">' + bazi.getYearNaYin() + '</td>';
                s += '<td class="small">' + bazi.getMonthNaYin() + '</td>';
                s += '<td class="small">' + bazi.getDayNaYin() + '</td>';
                s += '<td class="small">' + bazi.getTimeNaYin() + '</td>';
                if (currentYun) {

                    s += '<td class="small">' + currentYun.daYunNaYin + '</td>';
                    s += '<td class="small">' + currentYun.liuNianNaYin + '</td>';
                    s += '<td class="small">' + currentYun.liuYueNaYin + '</td>';
                    s += '<td class="small">' + currentYun.liuRiNaYin + '</td>';
                    s += '<td class="small">' + currentYun.liuShiNaYin + '</td>';
                    s += '<td colspan="2"></td>';
                } else {
                    s += '<td colspan="6"></td>';
                }
                s += '</tr>';

                s += '<tr>';
                s += '<td>空亡：</td>';
                s += '<td class="small">' + bazi.getYearXunKong() + '</td>';
                s += '<td class="small">' + bazi.getMonthXunKong() + '</td>';
                s += '<td class= "red small">' + bazi.getDayXunKong() + '</td>';
                s += '<td class="small">' + bazi.getTimeXunKong() + '</td>';
                if (currentYun) {

                    s += '<td class="small">' + currentYun.daYunXunKong + '</td>';
                    s += '<td class="small">' + currentYun.liuNianXunKong + '</td>';
                    s += '<td class="small">' + currentYun.liuYueXunKong + '</td>';
                    s += '<td class="small">' + currentYun.liuRiXunKong + '</td>';
                    s += '<td class="small">' + currentYun.liuShiXunKong + '</td>';
                    s += '<td colspan="2"></td>';
                } else {
                    s += '<td colspan="6"></td>';
                }
                s += '</tr>';

                s += '<tr>';
                s += '<td>日干：</td>';
                s += '<td class="small">' + bazi.getYearDiShi() + '</td>';
                s += '<td class="small">' + bazi.getMonthDiShi() + '</td>';
                s += '<td class="small">' + bazi.getDayDiShi() + '</td>';
                s += '<td class="small">' + bazi.getTimeDiShi() + '</td>';
                if (currentYun) {

                    s += '<td class="small">' + currentYun.daYunDiShi + '</td>';
                    s += '<td class="small">' + currentYun.liuNianDiShi + '</td>';
                    s += '<td class="small">' + currentYun.liuYueDiShi + '</td>';
                    s += '<td class="small">' + currentYun.liuRiDiShi + '</td>';
                    s += '<td class="small">' + currentYun.liuShiDiShi + '</td>';
                    s += '<td colspan="2"></td>';
                } else {
                    s += '<td colspan="6"></td>';
                }
                s += '</tr>';

                s += '<tr>';
                s += '<td>坐宫：</td>';
                s += '<td class="small">' + getChangSheng(bazi.getYearGan(), lunar.getYearGanIndexExact(), lunar.getYearZhiIndexExact()) + '</td>';
                s += '<td class="small">' + getChangSheng(bazi.getMonthGan(), lunar.getMonthGanIndexExact(), lunar.getMonthZhiIndexExact()) + '</td>';
                s += '<td class="small">' + getChangSheng(bazi.getDayGan(), 2 == bazi.getSect() ? lunar.getDayGanIndexExact2() : lunar.getDayGanIndexExact(), 2 == bazi.getSect() ? lunar.getDayZhiIndexExact2() : lunar.getDayZhiIndexExact()) + '</td>';
                s += '<td class="small">' + getChangSheng(bazi.getTimeGan(), lunar.getTimeGanIndex(), lunar.getTimeZhiIndex()) + '</td>';
                if (currentYun) {

                    s += '<td class="small">' + currentYun.daYunChangSheng + '</td>';
                    s += '<td class="small">' + currentYun.liuNianChangSheng + '</td>';
                    s += '<td class="small">' + currentYun.liuYueChangSheng + '</td>';
                    s += '<td class="small">' + currentYun.liuRiChangSheng + '</td>';
                    s += '<td class="small">' + currentYun.liuShiChangSheng + '</td>';
                    s += '<td colspan="2"></td>';
                } else {
                    s += '<td colspan="6"></td>';
                }
                s += '</tr>';

                var YinYang = {
                    '甲': '阳',
                    '丙': '阳',
                    '戊': '阳',
                    '庚': '阳',
                    '壬': '阳',

                    '子': '阳',
                    '寅': '阳',
                    '辰': '阳',
                    '午': '阳',
                    '申': '阳',
                    '戌': '阳',

                    '乙': '阴',
                    '丁': '阴',
                    '己': '阴',
                    '辛': '阴',
                    '癸': '阴',

                    '丑': '阴',
                    '卯': '阴',
                    '巳': '阴',
                    '未': '阴',
                    '酉': '阴',
                    '亥': '阴'
                };

                s += '<tr>';
                s += '<td>阴阳：</td>';
                s += '<td class="small">' + YinYang[bazi.getYearGan()] + YinYang[bazi.getYearZhi()] + '</td>';
                s += '<td class="small">' + YinYang[bazi.getMonthGan()] + YinYang[bazi.getMonthZhi()] + '</td>';
                s += '<td class="small">' + YinYang[bazi.getDayGan()] + YinYang[bazi.getDayZhi()] + '</td>';
                s += '<td class="small">' + YinYang[bazi.getTimeGan()] + YinYang[bazi.getTimeZhi()] + '</td>';
                if (currentYun) {

                    s += '<td class="small">' + (currentYun.daYunGan ? YinYang[currentYun.daYunGan] : '') + (currentYun.daYunZhi ? YinYang[currentYun.daYunZhi] : '') + '</td>';
                    s += '<td class="small">' + (currentYun.liuNianGan ? YinYang[currentYun.liuNianGan] : '') + (currentYun.liuNianZhi ? YinYang[currentYun.liuNianZhi] : '') + '</td>';
                    s += '<td class="small">' + (currentYun.liuYueGan ? YinYang[currentYun.liuYueGan] : '') + (currentYun.liuYueZhi ? YinYang[currentYun.liuYueZhi] : '') + '</td>';
                    s += '<td class="small">' + (currentYun.liuRiGan ? YinYang[currentYun.liuRiGan] : '') + (currentYun.liuRiZhi ? YinYang[currentYun.liuRiZhi] : '') + '</td>';
                    s += '<td class="small">' + (currentYun.liuShiGan ? YinYang[currentYun.liuShiGan] : '') + (currentYun.liuShiZhi ? YinYang[currentYun.liuShiZhi] : '') + '</td>';
                    s += '<td colspan="2"></td>';
                } else {
                    s += '<td colspan="6"></td>';
                }
                s += '</tr>';

                s += '<tr>';
                s += '<td>五行：</td>';
                s += '<td class="small">' + bazi.getYearWuXing() + '</td>';
                s += '<td class="small">' + bazi.getMonthWuXing() + '</td>';
                s += '<td class="small">' + bazi.getDayWuXing() + '</td>';
                s += '<td class="small">' + bazi.getTimeWuXing() + '</td>';
                if (currentYun) {

                    s += '<td class="small">' + currentYun.daYunWuXing + '</td>';
                    s += '<td class="small">' + currentYun.liuNianWuXing + '</td>';
                    s += '<td class="small">' + currentYun.liuYueWuXing + '</td>';
                    s += '<td class="small">' + currentYun.liuRiWuXing + '</td>';
                    s += '<td class="small">' + currentYun.liuShiWuXing + '</td>';
                    s += '<td colspan="2"></td>';
                } else {
                    s += '<td colspan="6"></td>';
                }
                s += '</tr>';


                s += '<tr>';

                // 年柱神煞
                var shenShaYear = [];
                // 月柱神煞
                var shenShaMonth = [];
                // 日柱神煞
                var shenShaDay = [];
                // 时柱神煞
                var shenShaTime = [];
                // 大运神煞
                var shenShadaYun = [];
                // 流年神煞
                var shenShaliuNian = [];
                // 流月神煞
                var shenShaliuYue = [];
                // 流日神煞
                var shenShaliuRi = [];
                // 流时神煞
                var shenShaliuShi = [];

                //四柱天干顺序同时出现
                var shenShaGanGan = {
                    '天三奇': ['甲戊庚', '庚戊甲'],
                    '地三奇': ['乙丙丁', '丁丙乙'],
                    '人三奇': ['壬癸辛', '辛癸壬']
                };

                //四柱地支顺序同时出现
                var shenShaZhiZhi = {
                    '三台': ['寅辰申', '卯巳午', '亥子酉']
                };

                // 年日天干查地支
                var shenShaYearDayGanZhi = {
                    '天乙': ['甲丑', '甲未', '乙子', '乙申', '丙亥', '丙酉', '丁亥', '丁酉', '戊丑', '戊未', '己子', '己申', '庚午', '庚寅', '庚丑', '庚未', '辛午', '辛寅', '壬卯', '壬巳', '癸卯', '癸巳'],
                    '太极': ['甲子', '甲午', '乙子', '乙午', '丙卯', '丙酉', '丁卯', '丁酉', '戊辰', '戊戌', '戊丑', '戊未', '己辰', '己戌', '己丑', '己未', '庚亥', '庚寅', '辛亥', '辛寅', '壬申', '壬巳', '癸申', '癸巳'],
                    '天印': ['甲寅', '乙亥', '丙戌', '丁酉', '戊申', '己未', '庚午', '辛巳', '壬辰', '癸卯'],
                    '天厨': ['甲巳', '乙午', '丙巳', '丁午', '戊申', '己酉', '庚亥', '辛子', '壬寅', '癸卯'],
                    '天官': ['甲未', '乙辰', '丙巳', '丁酉', '丁寅', '戊戌', '戊丑', '己卯', '己戌', '庚丑', '庚亥', '辛申', '壬寅', '壬酉', '癸午'],
                    '文昌': ['甲巳', '乙午', '丙申', '丁酉', '戊申', '己酉', '庚亥', '辛子', '壬寅', '癸卯'],
                    '国印': ['甲戌', '甲亥', '甲酉', '乙亥', '乙子', '乙戌', '丙丑', '丙子', '丙寅', '丁寅', '丁丑', '丁卯', '戊丑', '戊子', '戊寅', '己寅', '己丑', '己卯', '庚辰', '庚卯', '庚巳', '辛巳', '辛辰', '辛午', '壬未', '壬午', '壬申', '癸申', '癸未', '癸酉'],
                    '福星': ['甲寅', '甲子', '乙卯', '乙丑', '丙寅', '丙子', '丁亥', '丁酉', '戊申', '己未', '庚午', '辛巳', '壬辰', '癸卯', '癸丑'],
                    '金舆': ['甲辰', '乙巳', '丙未', '丁申', '戊未', '己申', '庚戌', '辛亥', '壬丑', '癸寅'],
                    '穷煞': ['甲巳', '乙寅', '丙子', '丁戌', '戊申', '己午', '庚卯', '辛丑', '壬亥', '癸酉'],
                    '破祖': ['甲午', '乙午', '丙申', '丁申', '戊戌', '己戌', '庚子', '辛子', '壬寅', '癸寅']
                };

                // 年日天干查干支
                var shenShaYearGanDayGanGanZhi = {
                    '学堂': ['甲己亥', '乙壬午', '丙丙寅', '丁丁酉', '戊戊申', '己己酉', '庚辛巳', '辛甲子', '壬甲申', '癸乙卯'],
                    '词馆': ['甲庚寅', '乙辛卯', '丙乙巳', '丁戊午', '戊丁巳', '己庚午', '庚壬申', '辛癸酉', '壬癸亥', '癸壬戌']
                };

                //年柱纳音查地支
                var shenShaYearNaYinDiZhi = {
                    '学堂': ['海中金巳', '剑锋金巳', '白蜡金巳', '沙中金巳', '金箔金巳', '钗钏金巳', '大林木亥', '杨柳木亥', '松柏木亥', '平地木亥', '桑柘木亥', '石榴木亥', '涧下水申', '泉中水申', '长流水申', '天河水申', '大溪水申', '大海水申', '霹雳火寅', '山下火寅', '覆灯火寅', '炉中火寅', '山头火寅', '天上火寅', '壁上土申', '大驿土申', '沙中土申', '路旁土申', '城头土申', '屋上土申'],
                    '词馆': ['海中金申', '剑锋金申', '白蜡金申', '沙中金申', '金箔金申', '钗钏金申', '大林木寅', '杨柳木寅', '松柏木寅', '平地木寅', '桑柘木寅', '石榴木寅', '涧下水亥', '泉中水亥', '长流水亥', '天河水亥', '大溪水亥', '大海水亥', '霹雳火巳', '山下火巳', '覆灯火巳', '炉中火巳', '山头火巳', '天上火巳', '壁上土亥', '大驿土亥', '沙中土亥', '路旁土亥', '城头土亥', '屋上土亥']
                };

                //年柱纳音查干支
                var shenShaYearNaYinGanZhi = {
                    '正学堂': ['海中金辛巳', '剑锋金辛巳', '白蜡金辛巳', '沙中金辛巳', '金箔金辛巳', '钗钏金辛巳', '大林木己亥', '杨柳木己亥', '松柏木己亥', '平地木己亥', '桑柘木己亥', '石榴木己亥', '涧下水甲申', '泉中水甲申', '长流水甲申', '天河水甲申', '大溪水甲申', '大海水甲申', '霹雳火丙寅', '山下火丙寅', '覆灯火丙寅', '炉中火丙寅', '山头火丙寅', '天上火丙寅', '壁上土戊申', '大驿土戊申', '沙中土戊申', '路旁土戊申', '城头土戊申', '屋上土戊申'],
                    '正词馆': ['海中金壬申', '剑锋金壬申', '白蜡金壬申', '沙中金壬申', '金箔金壬申', '钗钏金壬申', '大林木庚寅', '杨柳木庚寅', '松柏木庚寅', '平地木庚寅', '桑柘木庚寅', '石榴木庚寅', '涧下水癸亥', '泉中水癸亥', '长流水癸亥', '天河水癸亥', '大溪水癸亥', '大海水癸亥', '霹雳火乙巳', '山下火乙巳', '覆灯火乙巳', '炉中火乙巳', '山头火乙巳', '天上火乙巳', '壁上土丁亥', '大驿土丁亥', '沙中土丁亥', '路旁土丁亥', '城头土丁亥', '屋上土丁亥']
                };

                // 年日地支查地支
                var shenShaYearDayZhiZhi = {
                    '六厄': ['子卯', '丑子', '寅酉', '卯午', '辰卯', '巳子', '午酉', '未午', '申卯', '酉子', '戌酉', '亥午'],
                    '孤辰': ['子寅', '丑寅', '寅巳', '卯巳', '辰巳', '巳申', '午申', '未申', '申亥', '酉亥', '戌亥', '亥寅'],
                    '寡宿': ['子戌', '丑戌', '寅丑', '卯丑', '辰丑', '巳辰', '午辰', '未辰', '申未', '酉未', '戌未', '亥戌'],
                    '咸池': ['子酉', '丑午', '寅卯', '卯子', '辰酉', '巳午', '午卯', '未子', '申酉', '酉午', '戌卯', '亥子'],
                    '亡神': ['子亥', '丑申', '寅巳', '卯寅', '辰亥', '巳申', '午巳', '未寅', '申亥', '酉申', '戌巳', '亥寅'],
                    '劫煞': ['子巳', '丑寅', '寅亥', '卯申', '辰巳', '巳寅', '午亥', '未申', '申巳', '酉寅', '戌亥', '亥申'],
                    '灾煞': ['子午', '丑卯', '寅子', '卯酉', '辰午', '巳卯', '午子', '未酉', '申午', '酉卯', '戌子', '亥酉'],
                    '驿马': ['子寅', '丑亥', '寅申', '卯巳', '辰寅', '巳亥', '午申', '未巳', '申寅', '酉亥', '戌申', '亥巳'],
                    '华盖': ['子辰', '丑丑', '寅戌', '卯未', '辰辰', '巳丑', '午戌', '未未', '申辰', '酉丑', '戌戌', '亥未'],
                    '墓杀': ['子辰', '丑丑', '寅戌', '卯未', '辰辰', '巳丑', '午戌', '未未', '申辰', '酉丑', '戌戌', '亥未'],
                    '将星': ['子子', '丑酉', '寅午', '卯卯', '辰子', '巳酉', '午午', '未卯', '申子', '酉酉', '戌午', '亥卯'],
                    '天罗': ['戌亥', '亥戌'],
                    '地网': ['辰巳', '巳辰'],
                    '吟呻': ['子巳', '午巳', '卯巳', '酉巳'],
                    '破碎': ['寅酉', '申酉', '巳酉', '亥酉'],
                    '白衣': ['辰丑', '戌丑', '丑丑', '未丑']
                };

                //天罗地网(年柱纳音查地支)
                var shenShaYearNaYinYearDiZhi = {
                    '天罗': ['霹雳火戌', '山下火戌', '覆灯火戌', '炉中火戌', '山头火戌', '天上火戌', '霹雳火亥', '山下火亥', '覆灯火亥', '炉中火亥', '山头火亥', '天上火亥'],
                    '地网': ['涧下水辰', '泉中水辰', '长流水辰', '天河水辰', '大溪水辰', '大海水辰', '涧下水巳', '泉中水巳', '长流水巳', '天河水巳', '大溪水巳', '大海水巳', '壁上土辰', '大驿土辰', '沙中土辰', '路旁土辰', '城头土辰', '屋上土辰', '壁上土巳', '大驿土巳', '沙中土巳', '路旁土巳', '城头土巳', '屋上土巳']
                };

                //年日纳音查纳音
                var shenShaYearNaYinDayNaYin = {
                    '四大空': ['海中金涧下水', '海中金泉中水', '海中金长流水', '海中金天河水', '海中金大溪水', '海中金大海水', '炉中火涧下水', '炉中火泉中水', '炉中火长流水', '炉中火天河水', '炉中火大溪水', '炉中火大海水', '大林木涧下水', '大林木泉中水', '大林木长流水', '大林木天河水', '大林木大溪水', '大林木大海水', '路旁土涧下水', '路旁土泉中水', '路旁土长流水', '路旁土天河水', '路旁土大溪水', '路旁土大海水', '剑锋金涧下水', '剑锋金泉中水', '剑锋金长流水', '剑锋金天河水', '剑锋金大溪水', '剑锋金大海水', '沙中金涧下水', '沙中金泉中水', '沙中金长流水', '沙中金天河水', '沙中金大溪水', '沙中金大海水', '山下火涧下水', '山下火泉中水', '山下火长流水', '山下火天河水', '山下火大溪水', '山下火大海水', '平地木涧下水', '平地木泉中水', '平地木长流水', '平地木天河水', '平地木大溪水', '平地木大海水', '壁上土涧下水', '壁上土泉中水', '壁上土长流水', '壁上土天河水', '壁上土大溪水', '壁上土大海水', '金箔金涧下水', '金箔金泉中水', '金箔金长流水', '金箔金天河水', '金箔金大溪水', '金箔金大海水', '泉中水海中金', '泉中水剑锋金', '泉中水白蜡金', '泉中水沙中金', '泉中水金箔金', '泉中水钗钏金', '屋上土海中金', '屋上土剑锋金', '屋上土白蜡金', '屋上土沙中金', '屋上土金箔金', '屋上土钗钏金', '霹雳火海中金', '霹雳火剑锋金', '霹雳火白蜡金', '霹雳火沙中金', '霹雳火金箔金', '霹雳火钗钏金', '松柏木海中金', '松柏木剑锋金', '松柏木白蜡金', '松柏木沙中金', '松柏木金箔金', '松柏木钗钏金', '长流水海中金', '长流水剑锋金', '长流水白蜡金', '长流水沙中金', '长流水金箔金', '长流水钗钏金', '大溪水海中金', '大溪水剑锋金', '大溪水白蜡金', '大溪水沙中金', '大溪水金箔金', '大溪水钗钏金', '沙中土海中金', '沙中土剑锋金', '沙中土白蜡金', '沙中土沙中金', '沙中土金箔金', '沙中土钗钏金', '天上火海中金', '天上火剑锋金', '天上火白蜡金', '天上火沙中金', '天上火金箔金', '天上火钗钏金', '石榴木海中金', '石榴木剑锋金', '石榴木白蜡金', '石榴木沙中金', '石榴木金箔金', '石榴木钗钏金', '大海水海中金', '大海水剑锋金', '大海水白蜡金', '大海水沙中金', '大海水金箔金', '大海水钗钏金']
                };

                // 年支查大运流年地支
                var shenShaYearZhidaYunliuNianZhi = {
                    '丧门': ['子寅', '丑卯', '寅辰', '卯巳', '辰午', '巳未', '午申', '未酉', '申戌', '酉亥', '戌子', '亥丑'],
                    '吊客': ['子戌', '丑亥', '寅子', '卯丑', '辰寅', '巳卯', '午辰', '未巳', '申午', '酉未', '戌申', '亥酉']
                };

                // 年日地支查大运流年地支
                var shenShaYearZhiDayZhidaYunliuNianZhi = {
                    '披麻': ['子酉', '丑戌', '寅亥', '卯子', '辰丑', '巳寅', '午卯', '未辰', '申巳', '酉午', '戌未', '亥申']
                };

                //年支查地支
                var shenShaYearZhiDiZhi = {
                    '红鸾': ['子卯', '丑寅', '寅丑', '卯子', '辰亥', '巳戌', '午酉', '未申', '申未', '酉午', '戌巳', '亥辰'],
                    '天喜': ['子酉', '丑申', '寅未', '卯午', '辰巳', '巳辰', '午卯', '未寅', '申丑', '酉子', '戌亥', '亥戌'],
                    '自缢煞': ['子酉', '丑午', '寅未', '卯申', '辰亥', '巳戌', '午丑', '未寅', '申卯', '酉子', '戌巳', '亥辰'],
                    '埋儿杀': ['子丑', '丑卯', '寅申', '卯丑', '辰卯', '巳申', '午丑', '未卯', '申申', '酉丑', '戌卯', '亥申'],
                    '兼刃': ['寅戌', '卯亥', '申辰', '酉巳'],
                    '病符': ['子亥', '丑子', '寅丑', '卯寅', '辰卯', '巳辰', '午巳', '未午', '申未', '酉申', '戌酉', '亥戌'],
                    '吞陷煞': ['子戌', '丑丑', '丑寅', '卯巳', '卯戌', '辰辰', '巳申', '午寅', '未寅', '申巳', '申戌', '酉戌', '戌寅', '戌酉', '亥寅'],
                    '攀鞍': ['子丑', '丑戌', '寅未', '卯辰', '辰丑', '巳戌', '午未', '未辰', '申丑', '酉戌', '戌未', '亥辰'],
                    '大耗': ['子巳', '丑午', '寅未', '卯申', '辰酉', '巳戌', '午亥', '未子', '申丑', '酉寅', '戌卯', '亥辰'],
                    '小耗': ['子午', '丑未', '寅申', '卯酉', '辰戌', '巳亥', '午子', '未丑', '申寅', '酉卯', '戌辰', '亥巳']
                };

                //年支查干支
                var shenShaYearZhiGanZhi = {
                    '兼刃': ['子壬申', '丑癸酉', '辰壬子', '巳癸丑', '午丙寅', '未己卯', '未丁卯', '戌丙午', '亥己未', '亥丁未']
                };

                // 月支查天干或地支
                var shenShaMonthZhiGanZhi = {
                    '天德': ['寅丁', '卯申', '辰壬', '巳辛', '午亥', '未甲', '申癸', '酉寅', '戌丙', '亥乙', '子巳', '丑庚'],
                    '天德合': ['寅壬', '卯巳', '辰丁', '巳丙', '午寅', '未己', '申戊', '酉亥', '戌辛', '亥庚', '子申', '丑乙'],
                    '月德': ['寅丙', '卯甲', '辰壬', '巳庚', '午丙', '未甲', '申壬', '酉庚', '戌丙', '亥甲', '子壬', '丑庚'],
                    '月德合': ['寅辛', '卯巳', '辰丁', '巳乙', '午辛', '未己', '申丁', '酉乙', '戌辛', '亥己', '子丁', '丑乙'],
                    '[德]秀': ['寅丙', '寅丁', '卯甲', '卯乙', '辰壬', '辰癸', '辰戊', '辰己', '巳庚', '巳辛', '午丙', '午丁', '未甲', '未乙', '申壬', '申癸', '申戊', '申己', '酉庚', '酉辛', '戌丙', '戌丁', '亥甲', '亥乙', '子壬', '子癸', '子戊', '子己', '丑庚', '丑辛'],
                    '德[秀]': ['寅戊', '寅癸', '卯丁', '卯壬', '辰丙', '辰辛', '辰甲', '辰己', '巳乙', '巳庚', '午戊', '午癸', '未丁', '未壬', '申丙', '申辛', '申甲', '申己', '戌戊', '戌癸', '亥丁', '亥壬', '子丙', '子辛', '子甲', '子己', '丑乙', '丑庚'],
                    '注受': ['寅子', '卯亥', '辰戌', '巳酉', '午戌', '未亥', '申子', '酉丑', '戌寅', '亥卯', '子寅', '丑丑'],
                    '五鬼': ['寅午', '卯未', '辰申', '巳酉', '午戌', '未亥', '申子', '酉丑', '戌寅', '亥卯', '子辰', '丑巳'],
                    '月破': ['寅申', '卯酉', '辰戌', '巳亥', '午子', '未丑', '申寅', '酉卯', '戌辰', '亥巳', '子午', '丑未'],
                    '天医': ['寅丑', '卯寅', '辰卯', '巳辰', '午巳', '未午', '申未', '酉申', '戌酉', '亥戌', '子亥', '丑子'],
                    '戟锋煞': ['寅甲', '卯乙', '辰戊', '巳丙', '午丁', '未己', '申庚', '酉辛', '戌戊', '亥壬', '子癸', '丑巳']
                };

                //月支查日干支
                var shenShaMonthZhiDayGanZhi = {
                    '四废日': ['寅庚申', '卯庚申', '辰庚申', '寅辛酉', '卯辛酉', '辰辛酉', '巳壬子', '午壬子', '未壬子', '巳癸亥', '午癸亥', '未癸亥', '申甲寅', '酉甲寅', '戌甲寅', '申乙卯', '酉乙卯', '戌乙卯', '亥丙午', '子丙午', '丑丙午', '亥丁巳', '子丁巳', '丑丁巳'],
                    '天赦日': ['寅戊寅', '卯戊寅', '辰戊寅', '巳甲午', '午甲午', '未甲午', '申戊申', '酉戊申', '戌戊申', '亥甲子', '子甲子', '丑甲子']
                };

                //查日时干支    
                var shenShaDayTimeGanZhi = {
                    '孤鸾': ['乙巳', '丁巳', '辛亥', '戊申', '甲寅', '戊午', '丙午', '壬子'],
                    '金神': ['乙丑', '己巳', '癸酉']
                };

                //只查日干支
                var shenShaDayDayGanZhi = {
                    '差错': ['丙子', '丁丑', '戊寅', '辛卯', '壬辰', '癸巳', '丙午', '丁未', '戊申', '辛酉', '壬戌', '癸亥'],
                    '大败': ['甲辰', '乙巳', '丙申', '丁亥', '戊戌', '己丑', '庚辰', '辛巳', '壬申', '癸亥'],
                    '六秀日': ['丙午', '丁未', '戊子', '戊午', '己丑', '己未'],
                    '日德': ['甲寅', '丙辰', '戊辰', '庚辰', '壬戌'],
                    '日贵': ['丁酉', '丁亥', '癸卯', '癸巳'],
                    '进神': ['甲子', '甲午', '乙卯', '乙酉'],
                    '退神': ['丁丑', '丁未', '壬辰', '壬戌'],
                    '魁罡': ['壬辰', '庚辰', '庚戌', '戊戌'],
                    '阴阳煞': ['丙子', '戊午'],
                    '八专': ['甲寅', '乙卯', '戊戌', '己未', '丁未', '庚申', '辛酉', '癸丑'],
                    '九丑': ['戊子', '戊午', '壬子', '壬午', '乙卯', '己卯', '辛卯', '己酉', '辛卯']
                };

                //日干查地支    
                var shenShaDayGanDiZhi = {
                    '羊刃': ['甲卯', '乙寅', '丙午', '丁巳', '戊午', '己巳', '庚酉', '辛申', '壬子', '癸亥'],
                    '飞刃': ['甲酉', '乙申', '丙子', '丁亥', '戊子', '己亥', '庚卯', '辛寅', '壬午', '癸巳'],
                    '红艳': ['甲午', '乙申', '丙寅', '丁未', '戊辰', '己辰', '庚戌', '辛酉', '壬子', '癸申'],
                    '流霞': ['甲酉', '乙戌', '丙未', '丁申', '戊巳', '己午', '庚辰', '辛卯', '壬亥', '癸寅'],
                    '沐浴': ['甲子', '乙巳', '丙卯', '丁申', '戊卯', '己申', '庚午', '辛亥', '壬酉', '癸寅'],
                    '墓库': ['甲未', '乙戌', '丙戌', '丁丑', '戊戌', '己丑', '庚丑', '辛辰', '壬辰', '癸未'],
                    '禄神': ['甲寅', '乙卯', '丙巳', '丁午', '戊巳', '己午', '庚申', '辛酉', '壬亥', '癸子'],
                    '水溺煞': ['丙子', '癸未', '癸丑']
                };

                //日干查时支    
                var shenShaDayGanTimeZhi = {
                    '截路': ['甲申', '甲酉', '乙申', '乙酉', '丙辰', '丙巳', '辛辰', '辛巳', '丁寅', '丁卯', '壬寅', '壬卯', '戊子', '戊丑', '癸子', '癸丑']
                };

                //日支查地支    
                var shenShaDayZhiDiZhi = {
                    '日破': ['子午', '丑未', '寅申', '卯酉', '辰戌', '巳亥', '午子', '未丑', '申寅', '酉卯', '戌辰', '亥巳']
                };

                //日支查时支    
                var shenShaDayZhiTimeZhi = {
                    '隔角煞': ['子寅', '丑卯', '寅辰', '卯巳', '辰午', '巳未', '午申', '未酉', '申戌', '酉亥', '戌子', '亥丑']
                };

                //查日柱时柱
                var shenShaDayGanZhiTimeGanZhi = {
                    '拱子禄': ['癸亥癸丑', '癸丑癸亥'],
                    '拱午禄': ['丁巳丁未', '己未己巳'],
                    '拱巳禄': ['戊辰戊午']
                };

                //童子(月支查日支时支)
                var shenShaMonthZhiDayZhiTimeZhi = {
                    '童子': ['寅寅', '卯寅', '辰寅', '申寅', '酉寅', '戌寅', '寅子', '卯子', '辰子', '申子', '酉子', '戌子', '巳卯', '午卯', '未卯', '亥卯', '子卯', '丑卯', '巳未', '午未', '未未', '亥未', '子未', '丑未', '巳辰', '午辰', '未辰', '亥辰', '子辰', '丑辰']
                };
                //童子(年柱纳音查日支和时支)
                var shenShaYearNaYinDayZhiTimeZhi = {
                    '童子': ['海中金午', '剑锋金午', '白蜡金午', '沙中金午', '金箔金午', '钗钏金午', '大林木午', '杨柳木午', '松柏木午', '平地木午', '桑柘木午', '石榴木午', '海中金卯', '剑锋金卯', '白蜡金卯', '沙中金卯', '金箔金卯', '钗钏金卯', '大林木卯', '杨柳木卯', '松柏木卯', '平地木卯', '桑柘木卯', '石榴木卯', '涧下水戌', '泉中水戌', '长流水戌', '天河水戌', '大溪水戌', '大海水戌', '涧下水酉', '泉中水酉', '长流水酉', '天河水酉', '大溪水酉', '大海水酉', '霹雳火戌', '山下火戌', '覆灯火戌', '炉中火戌', '山头火戌', '天上火戌', '霹雳火酉', '山下火酉', '覆灯火酉', '炉中火酉', '山头火酉', '天上火酉', '壁上土辰', '大驿土辰', '沙中土辰', '路旁土辰', '城头土辰', '屋上土辰', '壁上土巳', '大驿土巳', '沙中土巳', '路旁土巳', '城头土巳', '屋上土巳']
                };

                // 年支查地支，男女分别看（阳男阴女）
                var shenShaYearZhiZhiYangNanYinNv = {
                    '勾煞': ['子卯', '丑辰', '寅巳', '卯午', '辰未', '巳申', '午酉', '未戌', '申亥', '酉子', '戌丑', '亥寅'],
                    '绞煞': ['子酉', '丑戌', '寅亥', '卯子', '辰丑', '巳寅', '午卯', '未辰', '申巳', '酉午', '戌未', '亥申'],
                    '元辰': ['子未', '丑申', '寅酉', '卯戌', '辰亥', '巳子', '午丑', '未寅', '申卯', '酉辰', '戌巳', '亥午']
                };

                // 年支查地支，男女分别看（阴男阳女）    
                var shenShaYearZhiZhiYinNanYangNv = {
                    '勾煞': ['子酉', '丑戌', '寅亥', '卯子', '辰丑', '巳寅', '午卯', '未辰', '申巳', '酉午', '戌未', '亥申'],
                    '绞煞': ['子卯', '丑辰', '寅巳', '卯午', '辰未', '巳申', '午酉', '未戌', '申亥', '酉子', '戌丑', '亥寅'],
                    '元辰': ['子巳', '丑午', '寅未', '卯申', '辰酉', '巳戌', '午亥', '未子', '申丑', '酉寅', '戌卯', '亥辰']
                };

                // 阳
                var yang = (0 == lunar.getYearGanIndexExact() % 2);
                // 男
                var man = (1 == gender);
                // 阳男阴女
                var yangManOrYinWoman = (yang && man) || (!yang && !man);
                // 根据阳男阴女或阴男阳女选择不同的关系
                var shenShaYearZhiZhiNN = yangManOrYinWoman ? shenShaYearZhiZhiYangNanYinNv : shenShaYearZhiZhiYinNanYangNv;

                // 年柱神煞开始
                // 每柱神煞开始才加这一行
                var shenShaTemp = {};

                for (var i in shenShaGanGan) {
                    var gzs = shenShaGanGan[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearGan() + bazi.getMonthGan() + bazi.getDayGan() || gz == bazi.getMonthGan() + bazi.getDayGan() + bazi.getTimeGan()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaZhiZhi) {
                    var gzs = shenShaZhiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearZhi() + bazi.getMonthZhi() + bazi.getDayZhi() || gz == bazi.getYearZhi() + bazi.getMonthZhi() + bazi.getTimeZhi() || gz == bazi.getYearZhi() + bazi.getDayZhi() + bazi.getTimeZhi() || gz == bazi.getMonthZhi() + bazi.getDayZhi() + bazi.getTimeZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearDayGanZhi) {
                    var gzs = shenShaYearDayGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearGan() + bazi.getYearZhi() || gz == bazi.getDayGan() + bazi.getYearZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearDayZhiZhi) {
                    var gzs = shenShaYearDayZhiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getDayZhi() + bazi.getYearZhi() || gz == bazi.getYearZhi() + bazi.getYearZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearNaYinYearDiZhi) {
                    var gzs = shenShaYearNaYinYearDiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearNaYin() + bazi.getYearZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaMonthZhiGanZhi) {
                    var gzs = shenShaMonthZhiGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getMonthZhi() + bazi.getYearGan() || gz == bazi.getMonthZhi() + bazi.getYearZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaDayGanDiZhi) {
                    var gzs = shenShaDayGanDiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getDayGan() + bazi.getYearZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearGanDayGanGanZhi) {
                    var gzs = shenShaYearGanDayGanGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getDayGan() + bazi.getYear()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearNaYinDiZhi) {
                    var gzs = shenShaYearNaYinDiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearNaYin() + bazi.getYearZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearNaYinGanZhi) {
                    var gzs = shenShaYearNaYinGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearNaYin() + bazi.getYear()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearNaYinDayNaYin) {
                    var gzs = shenShaYearNaYinDayNaYin[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getDayNaYin() + bazi.getYearNaYin()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaDayZhiDiZhi) {
                    var gzs = shenShaDayZhiDiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getDayZhi() + bazi.getYearZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                // 神煞结束才调用这段
                for (var i in shenShaTemp) {
                    shenShaYear.push(i);
                }
                // 年柱神煞结束

                // 月柱神煞开始
                shenShaTemp = {};
                for (var i in shenShaYearDayGanZhi) {
                    var gzs = shenShaYearDayGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearGan() + bazi.getMonthZhi() || gz == bazi.getDayGan() + bazi.getMonthZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearDayZhiZhi) {
                    var gzs = shenShaYearDayZhiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearZhi() + bazi.getMonthZhi() || gz == bazi.getDayZhi() + bazi.getMonthZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearNaYinYearDiZhi) {
                    var gzs = shenShaYearNaYinYearDiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearNaYin() + bazi.getMonthZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaMonthZhiGanZhi) {
                    var gzs = shenShaMonthZhiGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getMonthZhi() + bazi.getMonthGan()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaDayGanDiZhi) {
                    var gzs = shenShaDayGanDiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getDayGan() + bazi.getMonthZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearZhiDiZhi) {
                    var gzs = shenShaYearZhiDiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearZhi() + bazi.getMonthZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearZhiGanZhi) {
                    var gzs = shenShaYearZhiGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearZhi() + bazi.getMonth()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearGanDayGanGanZhi) {
                    var gzs = shenShaYearGanDayGanGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearGan() + bazi.getMonth() || gz == bazi.getDayGan() + bazi.getMonth()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearNaYinDiZhi) {
                    var gzs = shenShaYearNaYinDiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearNaYin() + bazi.getMonthZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearNaYinGanZhi) {
                    var gzs = shenShaYearNaYinGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearNaYin() + bazi.getMonth()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearZhiZhiNN) {
                    var gzs = shenShaYearZhiZhiNN[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearZhi() + bazi.getMonthZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearNaYinDayNaYin) {
                    var gzs = shenShaYearNaYinDayNaYin[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearNaYin() + bazi.getMonthNaYin() || gz == bazi.getDayNaYin() + bazi.getMonthNaYin()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaDayZhiDiZhi) {
                    var gzs = shenShaDayZhiDiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getDayZhi() + bazi.getMonthZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaTemp) {
                    shenShaMonth.push(i);
                }
                // 月柱神煞结束

                // 日柱神煞开始      
                shenShaTemp = {};
                for (var i in shenShaYearDayGanZhi) {
                    var gzs = shenShaYearDayGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearGan() + bazi.getDayZhi() || gz == bazi.getDayGan() + bazi.getDayZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearDayZhiZhi) {
                    var gzs = shenShaYearDayZhiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearZhi() + bazi.getDayZhi() || gz == bazi.getDayZhi() + bazi.getDayZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearNaYinYearDiZhi) {
                    var gzs = shenShaYearNaYinYearDiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearNaYin() + bazi.getDayZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaMonthZhiGanZhi) {
                    var gzs = shenShaMonthZhiGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getMonthZhi() + bazi.getDayGan() || gz == bazi.getMonthZhi() + bazi.getDayZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaDayTimeGanZhi) {
                    var gzs = shenShaDayTimeGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getDay()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaDayDayGanZhi) {
                    var gzs = shenShaDayDayGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getDay()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaDayGanDiZhi) {
                    var gzs = shenShaDayGanDiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getDay()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearZhiDiZhi) {
                    var gzs = shenShaYearZhiDiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearZhi() + bazi.getDayZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearZhiGanZhi) {
                    var gzs = shenShaYearZhiGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearZhi() + bazi.getDay()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaMonthZhiDayZhiTimeZhi) {
                    var gzs = shenShaMonthZhiDayZhiTimeZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getMonthZhi() + bazi.getDayZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearNaYinDayZhiTimeZhi) {
                    var gzs = shenShaYearNaYinDayZhiTimeZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearNaYin() + bazi.getDayZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearGanDayGanGanZhi) {
                    var gzs = shenShaYearGanDayGanGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearGan() + bazi.getDay() || gz == bazi.getDayGan() + bazi.getDay()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaMonthZhiDayGanZhi) {
                    var gzs = shenShaMonthZhiDayGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getMonthZhi() + bazi.getDay()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearZhiZhiNN) {
                    var gzs = shenShaYearZhiZhiNN[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearZhi() + bazi.getDayZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearNaYinDiZhi) {
                    var gzs = shenShaYearNaYinDiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearNaYin() + bazi.getDayZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearNaYinGanZhi) {
                    var gzs = shenShaYearNaYinGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearNaYin() + bazi.getDay()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearNaYinDayNaYin) {
                    var gzs = shenShaYearNaYinDayNaYin[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearNaYin() + bazi.getDayNaYin()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaTemp) {
                    shenShaDay.push(i);
                }
                // 日柱神煞结束

                // 时柱神煞开始 
                shenShaTemp = {};
                for (var i in shenShaYearDayGanZhi) {
                    var gzs = shenShaYearDayGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearGan() + bazi.getTimeZhi() || gz == bazi.getDayGan() + bazi.getTimeZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearDayZhiZhi) {
                    var gzs = shenShaYearDayZhiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearZhi() + bazi.getTimeZhi() || gz == bazi.getDayZhi() + bazi.getTimeZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearNaYinYearDiZhi) {
                    var gzs = shenShaYearNaYinYearDiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearNaYin() + bazi.getTimeZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaMonthZhiGanZhi) {
                    var gzs = shenShaMonthZhiGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getMonthZhi() + bazi.getTimeGan() || gz == bazi.getMonthZhi() + bazi.getTimeZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaDayTimeGanZhi) {
                    var gzs = shenShaDayTimeGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getTime()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaDayGanDiZhi) {
                    var gzs = shenShaDayGanDiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getDayGan() + bazi.getTimeZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearZhiDiZhi) {
                    var gzs = shenShaYearZhiDiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearZhi() + bazi.getTimeZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearZhiGanZhi) {
                    var gzs = shenShaYearZhiGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearZhi() + bazi.getTime()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearGanDayGanGanZhi) {
                    var gzs = shenShaYearGanDayGanGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearGan() + bazi.getTime() || gz == bazi.getDayGan() + bazi.getTime()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearZhiZhiNN) {
                    var gzs = shenShaYearZhiZhiNN[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearZhi() + bazi.getTimeZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearNaYinDiZhi) {
                    var gzs = shenShaYearNaYinDiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearNaYin() + bazi.getTimeZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearNaYinGanZhi) {
                    var gzs = shenShaYearNaYinGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearNaYin() + bazi.getTime()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaDayGanTimeZhi) {
                    var gzs = shenShaDayGanTimeZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getDayGan() + bazi.getTimeZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaDayZhiTimeZhi) {
                    var gzs = shenShaDayZhiTimeZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getDayZhi() + bazi.getTimeZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaDayGanZhiTimeGanZhi) {
                    var gzs = shenShaDayGanZhiTimeGanZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getDay() + bazi.getTime()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaMonthZhiDayZhiTimeZhi) {
                    var gzs = shenShaMonthZhiDayZhiTimeZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getMonthZhi() + bazi.getTimeZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearNaYinDayZhiTimeZhi) {
                    var gzs = shenShaYearNaYinDayZhiTimeZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearNaYin() + bazi.getTimeZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaYearNaYinDayNaYin) {
                    var gzs = shenShaYearNaYinDayNaYin[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getYearNaYin() + bazi.getTimeNaYin() || gz == bazi.getDayNaYin() + bazi.getTimeNaYin()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }


                for (var i in shenShaDayZhiDiZhi) {
                    var gzs = shenShaDayZhiDiZhi[i];
                    for (var j = 0, k = gzs.length; j < k; j++) {
                        var gz = gzs[j];
                        if (gz == bazi.getDayZhi() + bazi.getTimeZhi()) {
                            shenShaTemp[i] = true;
                        }
                    }
                }

                for (var i in shenShaTemp) {
                    shenShaTime.push(i);
                }
                // 时柱神煞结束

                // 大运神煞开始
                if (currentYun) {
                    if (currentYun.daYunGanZhi) {
                        shenShaTemp = {};
                        for (var i in shenShaYearDayGanZhi) {
                            var gzs = shenShaYearDayGanZhi[i];
                            for (var j = 0, k = gzs.length; j < k; j++) {
                                var gz = gzs[j];
                                if (gz == bazi.getYearGan() + currentYun.daYunGanZhi.substr(1) || gz == bazi.getDayGan() + currentYun.daYunGanZhi.substr(1)) {
                                    shenShaTemp[i] = true;
                                }
                            }
                        }
                        for (var i in shenShaTemp) {
                            shenShadaYun.push(i);
                        }
                    }
                }

                if (currentYun) {
                    if (currentYun.daYunGanZhi) {
                        shenShaTemp = {};
                        for (var i in shenShaYearDayZhiZhi) {
                            var gzs = shenShaYearDayZhiZhi[i];
                            for (var j = 0, k = gzs.length; j < k; j++) {
                                var gz = gzs[j];
                                if (gz == bazi.getYearZhi() + currentYun.daYunGanZhi.substr(1) || gz == bazi.getDayZhi() + currentYun.daYunGanZhi.substr(1)) {
                                    shenShaTemp[i] = true;
                                }
                            }
                        }
                        for (var i in shenShaTemp) {
                            shenShadaYun.push(i);
                        }
                    }
                }

                if (currentYun) {
                    if (currentYun.daYunGanZhi) {
                        shenShaTemp = {};
                        for (var i in shenShaYearNaYinYearDiZhi) {
                            var gzs = shenShaYearNaYinYearDiZhi[i];
                            for (var j = 0, k = gzs.length; j < k; j++) {
                                var gz = gzs[j];
                                if (gz == bazi.getYearNaYin() + currentYun.daYunGanZhi.substr(1)) {
                                    shenShaTemp[i] = true;
                                }
                            }
                        }
                        for (var i in shenShaTemp) {
                            shenShadaYun.push(i);
                        }
                    }
                }

                if (currentYun) {
                    if (currentYun.daYunGanZhi) {
                        shenShaTemp = {};
                        for (var i in shenShaMonthZhiGanZhi) {
                            var gzs = shenShaMonthZhiGanZhi[i];
                            for (var j = 0, k = gzs.length; j < k; j++) {
                                var gz = gzs[j];
                                if (gz == bazi.getMonthZhi() + currentYun.daYunGanZhi.substr(0, 1) || gz == bazi.getMonthZhi() + currentYun.daYunGanZhi.substr(1)) {
                                    shenShaTemp[i] = true;
                                }
                            }
                        }
                        for (var i in shenShaTemp) {
                            shenShadaYun.push(i);
                        }
                    }
                }

                if (currentYun) {
                    if (currentYun.daYunGanZhi) {
                        shenShaTemp = {};
                        for (var i in shenShaDayGanDiZhi) {
                            var gzs = shenShaDayGanDiZhi[i];
                            for (var j = 0, k = gzs.length; j < k; j++) {
                                var gz = gzs[j];
                                if (gz == bazi.getDayGan() + currentYun.daYunGanZhi.substr(1)) {
                                    shenShaTemp[i] = true;
                                }
                            }
                        }
                        for (var i in shenShaTemp) {
                            shenShadaYun.push(i);
                        }
                    }
                }

                if (currentYun) {
                    if (currentYun.daYunGanZhi) {
                        shenShaTemp = {};
                        for (var i in shenShaYearZhiDiZhi) {
                            var gzs = shenShaYearZhiDiZhi[i];
                            for (var j = 0, k = gzs.length; j < k; j++) {
                                var gz = gzs[j];
                                if (gz == bazi.getYearZhi() + currentYun.daYunGanZhi.substr(1)) {
                                    shenShaTemp[i] = true;
                                }
                            }
                        }
                        for (var i in shenShaTemp) {
                            shenShadaYun.push(i);
                        }
                    }
                }

                if (currentYun) {
                    if (currentYun.daYunGanZhi) {
                        shenShaTemp = {};
                        for (var i in shenShaYearZhiGanZhi) {
                            var gzs = shenShaYearZhiGanZhi[i];
                            for (var j = 0, k = gzs.length; j < k; j++) {
                                var gz = gzs[j];
                                if (gz == bazi.getYearZhi() + currentYun.daYunGanZhi.substr(0, 1) + currentYun.daYunGanZhi.substr(1)) {
                                    shenShaTemp[i] = true;
                                }
                            }
                        }
                        for (var i in shenShaTemp) {
                            shenShadaYun.push(i);
                        }
                    }
                }

                if (currentYun) {
                    if (currentYun.daYunGanZhi) {
                        shenShaTemp = {};
                        for (var i in shenShaYearGanDayGanGanZhi) {
                            var gzs = shenShaYearGanDayGanGanZhi[i];
                            for (var j = 0, k = gzs.length; j < k; j++) {
                                var gz = gzs[j];
                                if (gz == bazi.getYearGan() + currentYun.daYunGanZhi.substr(0, 1) + currentYun.daYunGanZhi.substr(1) || gz == bazi.getDayGan() + currentYun.daYunGanZhi.substr(0, 1) + currentYun.daYunGanZhi.substr(1)) {
                                    shenShaTemp[i] = true;
                                }
                            }
                        }
                        for (var i in shenShaTemp) {
                            shenShadaYun.push(i);
                        }
                    }
                }

                if (currentYun) {
                    if (currentYun.daYunGanZhi) {
                        shenShaTemp = {};
                        for (var i in shenShaYearZhidaYunliuNianZhi) {
                            var gzs = shenShaYearZhidaYunliuNianZhi[i];
                            for (var j = 0, k = gzs.length; j < k; j++) {
                                var gz = gzs[j];
                                if (gz == bazi.getYearZhi() + currentYun.daYunGanZhi.substr(1)) {
                                    shenShaTemp[i] = true;
                                }
                            }
                        }
                        for (var i in shenShaTemp) {
                            shenShadaYun.push(i);
                        }
                    }
                }

                if (currentYun) {
                    if (currentYun.daYunGanZhi) {
                        shenShaTemp = {};
                        for (var i in shenShaYearZhiDayZhidaYunliuNianZhi) {
                            var gzs = shenShaYearZhiDayZhidaYunliuNianZhi[i];
                            for (var j = 0, k = gzs.length; j < k; j++) {
                                var gz = gzs[j];
                                if (gz == bazi.getYearZhi() + currentYun.daYunGanZhi.substr(1) || gz == bazi.getDayZhi() + currentYun.daYunGanZhi.substr(1)) {
                                    shenShaTemp[i] = true;
                                }
                            }
                        }
                        for (var i in shenShaTemp) {
                            shenShadaYun.push(i);
                        }
                    }
                }

                if (currentYun) {
                    if (currentYun.daYunGanZhi) {
                        shenShaTemp = {};
                        for (var i in shenShaYearZhiZhiNN) {
                            var gzs = shenShaYearZhiZhiNN[i];
                            for (var j = 0, k = gzs.length; j < k; j++) {
                                var gz = gzs[j];
                                if (gz == bazi.getYearZhi() + currentYun.daYunGanZhi.substr(1)) {
                                    shenShaTemp[i] = true;
                                }
                            }
                        }
                        for (var i in shenShaTemp) {
                            shenShadaYun.push(i);
                        }
                    }
                }

                if (currentYun) {
                    if (currentYun.daYunGanZhi) {
                        shenShaTemp = {};
                        for (var i in shenShaYearNaYinDiZhi) {
                            var gzs = shenShaYearNaYinDiZhi[i];
                            for (var j = 0, k = gzs.length; j < k; j++) {
                                var gz = gzs[j];
                                if (gz == bazi.getYearNaYin() + currentYun.daYunGanZhi.substr(1)) {
                                    shenShaTemp[i] = true;
                                }
                            }
                        }
                        for (var i in shenShaTemp) {
                            shenShadaYun.push(i);
                        }
                    }
                }

                if (currentYun) {
                    if (currentYun.daYunGanZhi) {
                        shenShaTemp = {};
                        for (var i in shenShaYearNaYinGanZhi) {
                            var gzs = shenShaYearNaYinGanZhi[i];
                            for (var j = 0, k = gzs.length; j < k; j++) {
                                var gz = gzs[j];
                                if (gz == bazi.getYearNaYin() + currentYun.daYunGanZhi.substr(0, 1) + currentYun.daYunGanZhi.substr(1)) {
                                    shenShaTemp[i] = true;
                                }
                            }
                        }
                        for (var i in shenShaTemp) {
                            shenShadaYun.push(i);
                        }
                    }
                }

                if (currentYun) {
                    if (currentYun.daYunGanZhi) {
                        shenShaTemp = {};
                        for (var i in shenShaYearNaYinDayNaYin) {
                            var gzs = shenShaYearNaYinDayNaYin[i];
                            for (var j = 0, k = gzs.length; j < k; j++) {
                                var gz = gzs[j];
                                if (gz == bazi.getYearNaYin() + currentYun.daYunNaYin || gz == bazi.getDayNaYin() + currentYun.daYunNaYin) {
                                    shenShaTemp[i] = true;
                                }
                            }
                        }
                        for (var i in shenShaTemp) {
                            shenShadaYun.push(i);
                        }
                    }
                }

                if (currentYun) {
                    if (currentYun.daYunGanZhi) {
                        shenShaTemp = {};
                        for (var i in shenShaDayZhiDiZhi) {
                            var gzs = shenShaDayZhiDiZhi[i];
                            for (var j = 0, k = gzs.length; j < k; j++) {
                                var gz = gzs[j];
                                if (gz == bazi.getDayZhi() + currentYun.daYunGanZhi.substr(1)) {
                                    shenShaTemp[i] = true;
                                }
                            }
                        }
                        for (var i in shenShaTemp) {
                            shenShadaYun.push(i);
                        }
                    }
                }

                // 大运神煞结束

                // 流年神煞开始
                if (currentYun.liuNianGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearDayGanZhi) {
                        var gzs = shenShaYearDayGanZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearGan() + currentYun.liuNianGanZhi.substr(1) || gz == bazi.getDayGan() + currentYun.liuNianGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuNian.push(i);
                    }
                }

                if (currentYun.liuNianGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearDayZhiZhi) {
                        var gzs = shenShaYearDayZhiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuNianGanZhi.substr(1) || gz == bazi.getDayZhi() + currentYun.liuNianGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuNian.push(i);
                    }
                }

                if (currentYun.liuNianGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearNaYinYearDiZhi) {
                        var gzs = shenShaYearNaYinYearDiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearNaYin() + currentYun.liuNianGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuNian.push(i);
                    }
                }

                if (currentYun.liuNianGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaMonthZhiGanZhi) {
                        var gzs = shenShaMonthZhiGanZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getMonthZhi() + currentYun.liuNianGanZhi.substr(0, 1) || gz == bazi.getMonthZhi() + currentYun.liuNianGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuNian.push(i);
                    }
                }

                if (currentYun.liuNianGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaDayGanDiZhi) {
                        var gzs = shenShaDayGanDiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getDayGan() + currentYun.liuNianGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuNian.push(i);
                    }
                }

                if (currentYun.liuNianGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearZhiDiZhi) {
                        var gzs = shenShaYearZhiDiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuNianGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuNian.push(i);
                    }
                }

                if (currentYun.liuNianGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearZhiGanZhi) {
                        var gzs = shenShaYearZhiGanZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuNianGanZhi.substr(0, 1) + currentYun.liuNianGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuNian.push(i);
                    }
                }

                if (currentYun.liuNianGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearGanDayGanGanZhi) {
                        var gzs = shenShaYearGanDayGanGanZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearGan() + currentYun.liuNianGanZhi.substr(0, 1) + currentYun.liuNianGanZhi.substr(1) || gz == bazi.getDayGan() + currentYun.liuNianGanZhi.substr(0, 1) + currentYun.liuNianGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuNian.push(i);
                    }
                }

                if (currentYun.liuNianGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearZhidaYunliuNianZhi) {
                        var gzs = shenShaYearZhidaYunliuNianZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuNianGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuNian.push(i);
                    }
                }

                if (currentYun.liuNianGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearZhiDayZhidaYunliuNianZhi) {
                        var gzs = shenShaYearZhiDayZhidaYunliuNianZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuNianGanZhi.substr(1) || gz == bazi.getDayZhi() + currentYun.liuNianGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuNian.push(i);
                    }
                }

                if (currentYun.liuNianGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearZhiZhiNN) {
                        var gzs = shenShaYearZhiZhiNN[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuNianGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuNian.push(i);
                    }
                }

                if (currentYun.liuNianGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearNaYinDiZhi) {
                        var gzs = shenShaYearNaYinDiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearNaYin() + currentYun.liuNianGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuNian.push(i);
                    }
                }

                if (currentYun.liuNianGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearNaYinGanZhi) {
                        var gzs = shenShaYearNaYinGanZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearNaYin() + currentYun.liuNianGanZhi.substr(0, 1) + currentYun.liuNianGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuNian.push(i);
                    }
                }

                if (currentYun.liuNianGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearNaYinDayNaYin) {
                        var gzs = shenShaYearNaYinDayNaYin[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearNaYin() + currentYun.liuNianNaYin || gz == bazi.getDayNaYin() + currentYun.liuNianNaYin) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuNian.push(i);
                    }
                }

                if (currentYun.liuNianGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaDayZhiDiZhi) {
                        var gzs = shenShaDayZhiDiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getDayZhi() + currentYun.liuNianGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuNian.push(i);
                    }
                }

                // 流年神煞结束

                // 流月神煞开始	  
                if (currentYun.liuYueGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearDayGanZhi) {
                        var gzs = shenShaYearDayGanZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearGan() + currentYun.liuYueGanZhi.substr(1) || gz == bazi.getDayGan() + currentYun.liuYueGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuYue.push(i);
                    }
                }

                if (currentYun.liuYueGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearDayZhiZhi) {
                        var gzs = shenShaYearDayZhiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuYueGanZhi.substr(1) || gz == bazi.getDayZhi() + currentYun.liuYueGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuYue.push(i);
                    }
                }

                if (currentYun.liuYueGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearNaYinYearDiZhi) {
                        var gzs = shenShaYearNaYinYearDiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearNaYin() + currentYun.liuYueGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuYue.push(i);
                    }
                }

                if (currentYun.liuYueGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaMonthZhiGanZhi) {
                        var gzs = shenShaMonthZhiGanZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getMonthZhi() + currentYun.liuYueGanZhi.substr(0, 1) || gz == bazi.getMonthZhi() + currentYun.liuYueGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuYue.push(i);
                    }
                }

                if (currentYun.liuYueGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaDayGanDiZhi) {
                        var gzs = shenShaDayGanDiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getDayGan() + currentYun.liuYueGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuYue.push(i);
                    }
                }

                if (currentYun.liuYueGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearZhiDiZhi) {
                        var gzs = shenShaYearZhiDiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuYueGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuYue.push(i);
                    }
                }

                if (currentYun.liuYueGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearZhidaYunliuNianZhi) {
                        var gzs = shenShaYearZhidaYunliuNianZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuYueGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuYue.push(i);
                    }
                }

                if (currentYun.liuYueGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearZhiDayZhidaYunliuNianZhi) {
                        var gzs = shenShaYearZhiDayZhidaYunliuNianZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuYueGanZhi.substr(1) || gz == bazi.getDayZhi() + currentYun.liuYueGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuYue.push(i);
                    }
                }

                if (currentYun.liuYueGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearZhiGanZhi) {
                        var gzs = shenShaYearZhiGanZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuYueGanZhi.substr(0, 1) + currentYun.liuYueGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuYue.push(i);
                    }
                }

                if (currentYun.liuYueGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearGanDayGanGanZhi) {
                        var gzs = shenShaYearGanDayGanGanZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearGan() + currentYun.liuYueGanZhi.substr(0, 1) + currentYun.liuYueGanZhi.substr(1) || gz == bazi.getDayGan() + currentYun.liuYueGanZhi.substr(0, 1) + currentYun.liuYueGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuYue.push(i);
                    }
                }

                if (currentYun.liuYueGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearZhiZhiNN) {
                        var gzs = shenShaYearZhiZhiNN[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuYueGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuYue.push(i);
                    }
                }

                if (currentYun.liuYueGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearNaYinDiZhi) {
                        var gzs = shenShaYearNaYinDiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearNaYin() + currentYun.liuYueGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuYue.push(i);
                    }
                }

                if (currentYun.liuYueGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearNaYinGanZhi) {
                        var gzs = shenShaYearNaYinGanZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearNaYin() + currentYun.liuYueGanZhi.substr(0, 1) + currentYun.liuYueGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuYue.push(i);
                    }
                }

                if (currentYun.liuYueGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearNaYinDayNaYin) {
                        var gzs = shenShaYearNaYinDayNaYin[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearNaYin() + currentYun.liuYueNaYin || gz == bazi.getDayNaYin() + currentYun.liuYueNaYin) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuYue.push(i);
                    }
                }

                if (currentYun.liuYueGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaDayZhiDiZhi) {
                        var gzs = shenShaDayZhiDiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getDayZhi() + currentYun.liuYueGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuYue.push(i);
                    }
                }

                // 流月神煞结束

                // 流日神煞开始	  
                if (currentYun.liuRiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearDayGanZhi) {
                        var gzs = shenShaYearDayGanZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearGan() + currentYun.liuRiGanZhi.substr(1) || gz == bazi.getDayGan() + currentYun.liuRiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuRi.push(i);
                    }
                }

                if (currentYun.liuRiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearNaYinYearDiZhi) {
                        var gzs = shenShaYearNaYinYearDiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearNaYin() + currentYun.liuRiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuRi.push(i);
                    }
                }

                if (currentYun.liuRiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaMonthZhiGanZhi) {
                        var gzs = shenShaMonthZhiGanZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getMonthZhi() + currentYun.liuRiGanZhi.substr(0, 1) || gz == bazi.getMonthZhi() + currentYun.liuRiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuRi.push(i);
                    }
                }

                if (currentYun.liuRiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaDayGanDiZhi) {
                        var gzs = shenShaDayGanDiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getDayGan() + currentYun.liuRiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuRi.push(i);
                    }
                }

                if (currentYun.liuRiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearZhiDiZhi) {
                        var gzs = shenShaYearZhiDiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuRiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuRi.push(i);
                    }
                }

                if (currentYun.liuRiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearZhidaYunliuNianZhi) {
                        var gzs = shenShaYearZhidaYunliuNianZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuRiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuRi.push(i);
                    }
                }

                if (currentYun.liuRiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearZhiDayZhidaYunliuNianZhi) {
                        var gzs = shenShaYearZhiDayZhidaYunliuNianZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuRiGanZhi.substr(1) || gz == bazi.getDayZhi() + currentYun.liuRiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuRi.push(i);
                    }
                }

                if (currentYun.liuRiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearZhiGanZhi) {
                        var gzs = shenShaYearZhiGanZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuRiGanZhi.substr(0, 1) + currentYun.liuRiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuRi.push(i);
                    }
                }

                if (currentYun.liuRiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearGanDayGanGanZhi) {
                        var gzs = shenShaYearGanDayGanGanZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearGan() + currentYun.liuRiGanZhi.substr(0, 1) + currentYun.liuRiGanZhi.substr(1) || gz == bazi.getDayGan() + currentYun.liuRiGanZhi.substr(0, 1) + currentYun.liuRiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuRi.push(i);
                    }
                }

                if (currentYun.liuRiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearZhiZhiNN) {
                        var gzs = shenShaYearZhiZhiNN[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuRiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuRi.push(i);
                    }
                }

                if (currentYun.liuRiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearDayZhiZhi) {
                        var gzs = shenShaYearDayZhiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuRiGanZhi.substr(1) || gz == bazi.getDayZhi() + currentYun.liuRiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuRi.push(i);
                    }
                }

                if (currentYun.liuRiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearNaYinDiZhi) {
                        var gzs = shenShaYearNaYinDiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearNaYin() + currentYun.liuRiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuRi.push(i);
                    }
                }

                if (currentYun.liuRiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearNaYinGanZhi) {
                        var gzs = shenShaYearNaYinGanZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearNaYin() + currentYun.liuRiGanZhi.substr(0, 1) + currentYun.liuRiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuRi.push(i);
                    }
                }

                if (currentYun.liuRiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearNaYinDayNaYin) {
                        var gzs = shenShaYearNaYinDayNaYin[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearNaYin() + currentYun.liuRiNaYin || gz == bazi.getDayNaYin() + currentYun.liuRiNaYin) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuRi.push(i);
                    }
                }

                if (currentYun.liuRiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaDayZhiDiZhi) {
                        var gzs = shenShaDayZhiDiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getDayZhi() + currentYun.liuRiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuRi.push(i);
                    }
                }

                // 流日神煞结束

                // 流时神煞开始	  
                if (currentYun.liuShiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearDayGanZhi) {
                        var gzs = shenShaYearDayGanZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearGan() + currentYun.liuShiGanZhi.substr(1) || gz == bazi.getDayGan() + currentYun.liuShiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuShi.push(i);
                    }
                }

                if (currentYun.liuShiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearNaYinYearDiZhi) {
                        var gzs = shenShaYearNaYinYearDiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearNaYin() + currentYun.liuShiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuShi.push(i);
                    }
                }

                if (currentYun.liuShiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaMonthZhiGanZhi) {
                        var gzs = shenShaMonthZhiGanZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getMonthZhi() + currentYun.liuShiGanZhi.substr(0, 1) || gz == bazi.getMonthZhi() + currentYun.liuShiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuShi.push(i);
                    }
                }

                if (currentYun.liuShiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaDayGanDiZhi) {
                        var gzs = shenShaDayGanDiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getDayGan() + currentYun.liuShiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuShi.push(i);
                    }
                }

                if (currentYun.liuShiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearZhiDiZhi) {
                        var gzs = shenShaYearZhiDiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuShiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuShi.push(i);
                    }
                }

                if (currentYun.liuShiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearZhidaYunliuNianZhi) {
                        var gzs = shenShaYearZhidaYunliuNianZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuShiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuShi.push(i);
                    }
                }

                if (currentYun.liuShiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearZhiDayZhidaYunliuNianZhi) {
                        var gzs = shenShaYearZhiDayZhidaYunliuNianZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuShiGanZhi.substr(1) || gz == bazi.getDayZhi() + currentYun.liuShiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuShi.push(i);
                    }
                }

                if (currentYun.liuShiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearZhiGanZhi) {
                        var gzs = shenShaYearZhiGanZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuShiGanZhi.substr(0, 1) + currentYun.liuShiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuShi.push(i);
                    }
                }

                if (currentYun.liuShiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearGanDayGanGanZhi) {
                        var gzs = shenShaYearGanDayGanGanZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearGan() + currentYun.liuShiGanZhi.substr(0, 1) + currentYun.liuShiGanZhi.substr(1) || gz == bazi.getDayGan() + currentYun.liuShiGanZhi.substr(0, 1) + currentYun.liuShiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuShi.push(i);
                    }
                }

                if (currentYun.liuShiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearZhiZhiNN) {
                        var gzs = shenShaYearZhiZhiNN[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuShiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuShi.push(i);
                    }
                }

                if (currentYun.liuShiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearDayZhiZhi) {
                        var gzs = shenShaYearDayZhiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearZhi() + currentYun.liuShiGanZhi.substr(1) || gz == bazi.getDayZhi() + currentYun.liuShiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuShi.push(i);
                    }
                }

                if (currentYun.liuShiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearNaYinDiZhi) {
                        var gzs = shenShaYearNaYinDiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearNaYin() + currentYun.liuShiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuShi.push(i);
                    }
                }

                if (currentYun.liuShiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearNaYinGanZhi) {
                        var gzs = shenShaYearNaYinGanZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearNaYin() + currentYun.liuShiGanZhi.substr(0, 1) + currentYun.liuShiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuShi.push(i);
                    }
                }

                if (currentYun.liuShiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaYearNaYinDayNaYin) {
                        var gzs = shenShaYearNaYinDayNaYin[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getYearNaYin() + currentYun.liuShiNaYin || gz == bazi.getDayNaYin() + currentYun.liuShiNaYin) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuShi.push(i);
                    }
                }

                if (currentYun.liuShiGanZhi) {
                    shenShaTemp = {};
                    for (var i in shenShaDayZhiDiZhi) {
                        var gzs = shenShaDayZhiDiZhi[i];
                        for (var j = 0, k = gzs.length; j < k; j++) {
                            var gz = gzs[j];
                            if (gz == bazi.getDayZhi() + currentYun.liuShiGanZhi.substr(1)) {
                                shenShaTemp[i] = true;
                            }
                        }
                    }
                    for (var i in shenShaTemp) {
                        shenShaliuShi.push(i);
                    }
                }

                // 流时神煞结束

                //日柱空亡
                var rzkw = bazi.getDayXunKong();
                //年支
                var yearZhi = bazi.getYearZhi();
                //月支
                var monthZhi = bazi.getMonthZhi();
                //日支
                var dayZhi = bazi.getDayZhi();
                //时支
                var timeZhi = bazi.getTimeZhi();
                //大运支
                var daYunZhi;
                if (currentYun.daYunGanZhi) {
                    daYunZhi = currentYun.daYunGanZhi.substr(1);
                }
                //流年支
                var liuNianZhi;
                if (currentYun.liuNianGanZhi) {
                    liuNianZhi = currentYun.liuNianGanZhi.substr(1);
                }
                //流月支
                var liuYueZhi;
                if (currentYun.liuYueGanZhi) {
                    liuYueZhi = currentYun.liuYueGanZhi.substr(1);
                }
                //流日支
                var liuRiZhi;
                if (currentYun.liuRiGanZhi) {
                    liuRiZhi = currentYun.liuRiGanZhi.substr(1);
                }
                //流时支
                var liuShiZhi;
                if (currentYun.liuShiGanZhi) {
                    liuShiZhi = currentYun.liuShiGanZhi.substr(1);
                }

                if (rzkw.indexOf(yearZhi) != -1) {
                    shenShaYear.push("空亡");
                }
                if (rzkw.indexOf(monthZhi) != -1) {
                    shenShaMonth.push("空亡");
                }
                if (rzkw.indexOf(dayZhi) != -1) {
                    shenShaDay.push("空亡");
                }
                if (rzkw.indexOf(timeZhi) != -1) {
                    shenShaTime.push("空亡");
                }
                if (rzkw.indexOf(daYunZhi) != -1) {
                    shenShadaYun.push("空亡");
                }
                if (rzkw.indexOf(liuNianZhi) != -1) {
                    shenShaliuNian.push("空亡");
                }
                if (rzkw.indexOf(liuYueZhi) != -1) {
                    shenShaliuYue.push("空亡");
                }
                if (rzkw.indexOf(liuRiZhi) != -1) {
                    shenShaliuRi.push("空亡");
                }
                if (rzkw.indexOf(liuShiZhi) != -1) {
                    shenShaliuShi.push("空亡");
                }

                s += '<td>神煞：</td>';
                s += '<td class="small">' + (shenShaYear.length < 1 ? '无' : shenShaYear.join('<br>')) + '</td>';
                s += '<td class="small">' + (shenShaMonth.length < 1 ? '无' : shenShaMonth.join('<br>')) + '</td>';
                s += '<td class="small">' + (shenShaDay.length < 1 ? '无' : shenShaDay.join('<br>')) + '</td>';
                s += '<td class="small">' + (shenShaTime.length < 1 ? '无' : shenShaTime.join('<br>')) + '</td>';
                s += '<td class="small">' + (shenShadaYun.length < 1 ? '无' : shenShadaYun.join('<br>')) + '</td>';
                s += '<td class="small">' + (shenShaliuNian.length < 1 ? '无' : shenShaliuNian.join('<br>')) + '</td>';
                s += '<td class="small">' + (shenShaliuYue.length < 1 ? '无' : shenShaliuYue.join('<br>')) + '</td>';
                s += '<td class="small">' + (shenShaliuRi.length < 1 ? '无' : shenShaliuRi.join('<br>')) + '</td>';
                s += '<td class="small">' + (shenShaliuShi.length < 1 ? '无' : shenShaliuShi.join('<br>')) + '</td>';
                s += '</tr>';

                s += '<tr>';
                s += '<td>旺衰：</td>';
                var wxguanxi = {
                    '寅卯': '木旺 火相 水休 金囚 土死',
                    '巳午': '火旺 土相 木休 水囚 金死',
                    '申酉': '金旺 水相 土休 火囚 木死',
                    '亥子': '水旺 木相 金休 土囚 火死',
                    '辰戌丑未': '土旺 金相 火休 木囚 水死'
                };
                var monthZhi = bazi.getMonthZhi();
                var wx = '';
                for (var i in wxguanxi) {
                    if (i.indexOf(monthZhi) > -1) {
                        wx = wxguanxi[i];
                        break;
                    }
                }
                s += '<td colspan="20" class="left small">' + bazi.getDayGan() + LunarUtil.WU_XING_GAN[bazi.getDayGan()] + '生于' + bazi.getMonthZhi() + '月 ' + wx + '</td>';
                s += '</tr>';

                s += '<tr>';
                s += '<td>天干：</td>';
                var tgguanxi = {
                    '甲己': '甲己合土',
                    '乙庚': '乙庚合金',
                    '丙辛': '丙辛合水',
                    '丁壬': '丁壬合木',
                    '戊癸': '戊癸合火',
                    '甲庚': '甲庚相冲',
                    '乙辛': '乙辛相冲',
                    '丙壬': '丙壬相冲',
                    '丁癸': '丁癸相冲'
                };
                var gans = [];
                gans.push(bazi.getYearGan());
                gans.push(bazi.getMonthGan());
                gans.push(bazi.getDayGan());
                gans.push(bazi.getTimeGan());
                if (currentYun) {
                    if (currentYun.daYunGanZhi) {
                        gans.push(currentYun.daYunGanZhi.substr(0, 1));
                    }
                    if (currentYun.liuNianGanZhi) {
                        gans.push(currentYun.liuNianGanZhi.substr(0, 1));
                    }
                    if (currentYun.liuYueGanZhi) {
                        gans.push(currentYun.liuYueGanZhi.substr(0, 1));
                    }
                    if (currentYun.liuRiGanZhi) {
                        gans.push(currentYun.liuRiGanZhi.substr(0, 1));
                    }
                    if (currentYun.liuShiGanZhi) {
                        gans.push(currentYun.liuShiGanZhi.substr(0, 1));
                    }
                }

                var matched = [];
                var gxs = {};
                var size = gans.length;
                for (var i = 0; i < size; i++) {
                    for (var j = 0; j < size; j++) {
                        if (i === j) {
                            continue;
                        }
                        var v = tgguanxi[gans[i] + gans[j]];
                        if (v) {
                            gxs[v] = true;
                        }
                    }
                }
                for (var i in gxs) {
                    matched.push(i);
                }
                s += '<td colspan="20" class="left small">' + (matched.length < 1 ? '天干无冲合' : matched.join(' ')) + '</td>';;
                s += '</tr>';

                s += '<tr>';
                s += '<td>地支：</td>';
                var dzguanxi = {
                    '亥子丑': '亥子丑三会水',
                    '寅卯辰': '寅卯辰三会木',
                    '巳午未': '巳午未三会火',
                    '申酉戌': '申酉戌三会金',
                    '申子辰': '申子辰三合水',
                    '寅午戌': '寅午戌三合火',
                    '亥卯未': '亥卯未三合木',
                    '巳酉丑': '巳酉丑三合金',
                    '申子': '申子半合水',
                    '子辰': '子辰半合水',
                    '午戌': '午戌半合火',
                    '亥卯': '亥卯半合木',
                    '卯未': '卯未半合木',
                    '酉丑': '酉丑半合金',
                    '寅午': '寅午半合火(暗合土)',
                    '巳酉': '巳酉半合金(暗合水)',
                    '子巳': '子巳暗合火',
                    '卯申': '卯申暗合金',
                    '亥午': '亥午暗合木',
                    '巳申': '巳申六合水(相破)',
                    '辰酉': '辰酉六合金',
                    '卯戌': '卯戌六合火',
                    '寅亥': '寅亥六合木(相破)',
                    '子丑': '子丑六合土',
                    '午未': '午未六合火或土',
                    '子卯': '子卯无礼相刑',
                    '丑未戌': '丑未戌恃势刑',
                    '寅巳申': '寅巳申无恩刑',

                    '辰辰': '辰辰自刑',
                    '午午': '午午自刑',
                    '酉酉': '酉酉自刑',
                    '亥亥': '亥亥自刑',

                    '辰辰辰': '辰辰自刑',
                    '午午午': '午午自刑',
                    '酉酉酉': '酉酉自刑',
                    '亥亥亥': '亥亥自刑',

                    '辰辰辰辰': '辰辰自刑',
                    '午午午午': '午午自刑',
                    '酉酉酉酉': '酉酉自刑',
                    '亥亥亥亥': '亥亥自刑',

                    '辰辰辰辰辰': '辰辰自刑',
                    '午午午午午': '午午自刑',
                    '酉酉酉酉酉': '酉酉自刑',
                    '亥亥亥亥亥': '亥亥自刑',

                    '辰辰辰辰辰辰': '辰辰自刑',
                    '午午午午午午': '午午自刑',
                    '酉酉酉酉酉酉': '酉酉自刑',
                    '亥亥亥亥亥亥': '亥亥自刑',

                    '子午': '子午相冲',
                    '卯酉': '卯酉相冲',
                    '寅申': '寅申相冲',
                    '巳亥': '巳亥相冲',
                    '辰戌': '辰戌相冲',
                    '丑未': '丑未相冲',
                    '子未': '子未相害',
                    '丑午': '丑午相害',
                    '寅巳': '寅巳相害',
                    '卯辰': '卯辰相害',
                    '申亥': '申亥相害',
                    '酉戌': '酉戌相害',
                    '子酉': '子酉相破',
                    '卯午': '卯午相破',
                    '辰丑': '辰丑相破',
                    '未戌': '未戌相破'
                };
                var zhis = {};
                zhis[bazi.getYearZhi()] = zhis[bazi.getYearZhi()] ? zhis[bazi.getYearZhi()] + 1 : 1;
                zhis[bazi.getMonthZhi()] = zhis[bazi.getMonthZhi()] ? zhis[bazi.getMonthZhi()] + 1 : 1;
                zhis[bazi.getDayZhi()] = zhis[bazi.getDayZhi()] ? zhis[bazi.getDayZhi()] + 1 : 1;
                zhis[bazi.getTimeZhi()] = zhis[bazi.getTimeZhi()] ? zhis[bazi.getTimeZhi()] + 1 : 1;
                if (currentYun) {
                    if (currentYun.daYunZhi) {
                        zhis[currentYun.daYunZhi] = zhis[currentYun.daYunZhi] ? zhis[currentYun.daYunZhi] + 1 : 1;
                    }
                    if (currentYun.liuNianZhi) {
                        zhis[currentYun.liuNianZhi] = zhis[currentYun.liuNianZhi] ? zhis[currentYun.liuNianZhi] + 1 : 1;
                    }
                    if (currentYun.liuYueZhi) {
                        zhis[currentYun.liuYueZhi] = zhis[currentYun.liuYueZhi] ? zhis[currentYun.liuYueZhi] + 1 : 1;
                    }
                    if (currentYun.liuRiZhi) {
                        zhis[currentYun.liuRiZhi] = zhis[currentYun.liuRiZhi] ? zhis[currentYun.liuRiZhi] + 1 : 1;
                    }
                    if (currentYun.liuShiZhi) {
                        zhis[currentYun.liuShiZhi] = zhis[currentYun.liuShiZhi] ? zhis[currentYun.liuShiZhi] + 1 : 1;
                    }
                }

                var matched = [];
                var gxs = {};
                for (var i in zhis) {
                    for (var j in zhis) {
                        for (var k in zhis) {
                            if (i == j || j == k || i == k) {
                                continue;
                            }
                            var v = dzguanxi[i + j];
                            if (v) {
                                gxs[v] = true;
                            }
                            v = dzguanxi[i + j + k];
                            if (v) {
                                gxs[v] = true;
                            }
                        }
                    }
                }
                for (var i in zhis) {
                    var n = zhis[i];
                    var vs = [];
                    for (var j = 0; j < n; j++) {
                        vs.push(i);
                    }
                    var v = dzguanxi[vs.join('')];
                    if (v) {
                        gxs[v] = true;
                    }
                }

                var matchIndex = 0;
                for (var i in gxs) {
                    matched.push(i);
                    matchIndex++;
                    if (matchIndex % 4 == 0) {
                        matched.push('<br>');
                    }
                }
                s += '<td colspan="20" class="left small">' + (matched.join(' ')) + '</td>';

                s += '<tr>';
                s += '<td>太岁：</td>';
                var tsguanxi = {
                    '子子': '值太岁',
                    '丑丑': '值太岁',
                    '寅寅': '值太岁',
                    '卯卯': '值太岁',
                    '巳巳': '值太岁',
                    '未未': '值太岁',
                    '申申': '值太岁',
                    '戌戌': '值太岁',
                    '子卯': '刑太岁',
                    '丑戌': '刑太岁(丑戌未三刑)',
                    '辰辰': '刑太岁(值)',
                    '午午': '刑太岁(值)',
                    '酉酉': '刑太岁(值)',
                    '亥亥': '刑太岁(值)',
                    '子午': '冲太岁',
                    '卯酉': '冲太岁',
                    '寅申': '冲太岁(寅巳申三刑)',
                    '巳亥': '冲太岁',
                    '辰戌': '冲太岁',
                    '丑未': '冲太岁(丑戌未三刑)',
                    '子未': '害太岁',
                    '丑午': '害太岁',
                    '寅巳': '害太岁(寅巳申三刑)',
                    '卯辰': '害太岁',
                    '申亥': '害太岁',
                    '酉戌': '害太岁',
                    '子酉': '破太岁',
                    '卯午': '破太岁',
                    '辰丑': '破太岁',
                    '寅亥': '破太岁',
                    '巳申': '破太岁(寅巳申三刑)',
                    '未戌': '破太岁(丑戌未三刑)'
                };
                var zhis = [];
                zhis.push(bazi.getYearZhi());
                if (currentYun) {
                    if (currentYun.liuNianGanZhi) {
                        zhis.push(currentYun.liuNianGanZhi.substr(1));
                    }
                }

                var matched = [];
                var gxs = {};
                var size = zhis.length;
                for (var i = 0; i < size; i++) {
                    for (var j = 0; j < size; j++) {
                        if (i === j) {
                            continue;
                        }
                        var v = tsguanxi[zhis[i] + zhis[j]];
                        if (v) {
                            gxs[v] = true;
                        }
                    }
                }
                for (var i in gxs) {
                    matched.push(i);
                }
                s += '<td colspan="20" class="left small">' + (matched.length < 1 ? '未犯太岁' : matched.join(' ')) + '</td>';
                s += '</tr>';

                s += '<tr>';
                s += '<td>婚配：</td>';
                var hunpei = {
                    '子': '宜 (子丑合 申子辰合)  <span style="color:red">忌</span> (子午冲 子卯刑 子未害 子酉破)',
                    '丑': '宜 (子丑合 巳酉丑合)  <span style="color:red">忌</span> (丑未冲 丑戌未刑 丑午害 辰丑破)',
                    '寅': '宜 (寅亥合<破> 寅午戌合)  <span style="color:red">忌</span> (寅申冲 寅巳申刑 寅巳害)',
                    '卯': '宜 (卯戌合 亥卯未合)  <span style="color:red">忌</span> (卯酉冲 子卯刑 卯辰害 卯午破)',
                    '辰': '宜 (辰酉合 申子辰合)  <span style="color:red">忌</span> (辰戌冲 辰辰刑 卯辰害 辰丑破)',
                    '巳': '宜 (巳申合 巳酉丑合)  <span style="color:red">忌</span> (巳亥冲 寅巳申刑 寅巳害 巳申破)',
                    '午': '宜 (午未合 寅午戌合)  <span style="color:red">忌</span> (子午冲 午午刑 丑午害 卯午破)',
                    '未': '宜 (午未合 亥卯未合)  <span style="color:red">忌</span> (丑未冲 丑戌未刑 子未害 未戌破)',
                    '申': '宜 (巳申合<破> 申子辰合)  <span style="color:red">忌</span> (寅申冲 寅巳申刑 申亥害)',
                    '酉': '宜 (辰酉合 巳酉丑合)  <span style="color:red">忌</span> (卯酉冲 酉酉刑 酉戌害 子酉破)',
                    '戌': '宜 (卯戌合 寅午戌合)  <span style="color:red">忌</span> (辰戌冲 丑戌未刑 酉戌害 未戌破)',
                    '亥': '宜 (寅亥合<破> 亥卯未合)  <span style="color:red">忌</span> (巳亥冲 亥亥刑 申亥害)'
                };
                var yearZhi = bazi.getYearZhi();
                var hp = '';
                for (var i in hunpei) {
                    if (i.indexOf(yearZhi) > -1) {
                        hp = hunpei[i];
                        break;
                    }
                }
                s += '<td colspan="20" class="left small">' + hp + '</td>';
                s += '</tr>';

                // 2 end>

                if (-1 != gender) {

                    s += '<tr>';
                    s += '<td>三垣：</td>';
                    s += '<td colspan="20" class="left small">' + '胎元 ' + bazi.getTaiYuan() + '(' + bazi.getTaiYuanNaYin() + ')' + '；命宫 ' + bazi.getMingGong() + '(' + bazi.getMingGongNaYin() + ')' + '；身宫 ' + bazi.getShenGong() + '(' + bazi.getShenGongNaYin() + ')' + '</td>';
                    s += '</tr>';

                    s += '<tr>';
                    s += '<td>起运：</td>';
                    s += '<td colspan="20" class="left small">' + startYunSolar.getYear() + '年' + startYunSolar.getMonth() + '月' + startYunSolar.getDay() + '日</td>';
                    s += '</tr>';

                    s += '<tr>';
                    s += '<td>周岁：</td>';
                    for (var i = 0; i < daYunSize; i++) {
                        var d = daYun[i];
                        s += '<td' + (i >= daYunSize - 2 ? ' class="hide"' : '') + '>' + d.getStartAge() + '</td>';
                    }
                    s += '</tr>';
                    s += '<tr>';
                    s += '<td>换运：</td>';
                    for (var i = 0; i < daYunSize; i++) {
                        var d = daYun[i];
                        s += '<td' + (i >= daYunSize - 2 ? ' class="hide"' : '') + '>' + d.getStartYear() + '</td>';
                    }
                    s += '</tr>';
                    s += '<tr>';
                    s += '<td>十神：</td>';
                    for (var i = 0; i < daYunSize; i++) {
                        var d = daYun[i];
                        var shiShen = LunarUtil.SHI_SHEN_GAN[bazi.getDayGan() + d.getGanZhi().substr(0, 1)];
                        s += '<td class="small' + (i >= daYunSize - 2 ? ' hide' : '') + '">' + (shiShen ? shiShen : '') + '</td>';
                    }
                    s += '</tr>';
                    s += '<tr>';
                    s += '<td>大运：</td>';
                    for (var i = 0; i < daYunSize; i++) {
                        var d = daYun[i];
                        var ganZhi = d.getGanZhi();
                        if (!ganZhi) {
                            s += '<td class="red">童限</td>';
                        } else {
                            s += '<td class="bold' + (d.getStartYear() <= currentYear && currentYear <= d.getEndYear() ? ' red' : '') + (i >= daYunSize - 2 ? ' hide' : '') + '">' + ganZhi + '</td>';
                        }
                    }
                    s += '</tr>';
                    s += '<tr>';
                    s += '<td valign="top">流年：</td>';
                    for (var i = 0; i < daYunSize; i++) {
                        var d = daYun[i];
                        var liuNian = d.getLiuNian();
                        s += '<td valign="top"' + (i >= daYunSize - 2 ? ' class="hide"' : '') + '>';
                        for (var x = 0, y = liuNian.length; x < y; x++) {
                            var n = liuNian[x];
                            s += '<div' + (n.getYear() == currentYear ? ' class="red"' : '') + '>' + n.getGanZhi() + '</div>';
                        }
                        s += '</td>';
                    }
                    s += '</tr>';



                }

                s += '</tbody></table>';
                result.innerHTML = s;
            };

            var computeLunar = function(year, month, day, hour, minute, gender) {
                var lunar = Lunar.fromYmdHms(year, month, day, hour, minute, 0);
                var solar = lunar.getSolar();
                computeEightChar(lunar, solar, gender);
            };

            var computeSolar = function(year, month, day, hour, minute, gender) {
                var solar = Solar.fromYmdHms(year, month, day, hour, minute, 0);
                var lunar = solar.getLunar();
                computeEightChar(lunar, solar, gender);
            };

            var compute = function(v) {
                // 传入参数v
                // v为真太阳时字符串
                // by dachuan
                result.innerHTML = '';
                //var v = trim(input.value);
                v = trim(v);
                if (lunarCheck.checked) {
                    var year = parseInt(v.substr(0, 4));
                    v = v.substr(4);
                    var leapMonth = false;
                    if (v.indexOf(' ') == 0) {
                        leapMonth = true;
                    }
                    v = trim(v);
                    var month = parseInt(v.substr(0, 2), 10);
                    if (leapMonth) {
                        if (LunarUtil.getLeapMonth(year) == month) {
                            month = -month;
                        }
                    }

                    v = trim(v.substr(2));
                    var day = parseInt(v.substr(0, 2), 10);
                    v = trim(v.substr(2));
                    var hour = parseInt(v.substr(0, 2), 10);
                    v = trim(v.substr(2));
                    var minute = parseInt(v.substr(0, 2), 10);
                    v = trim(v.substr(2));
                    var gender = -1;
                    if ('+' == v) {
                        gender = 1;
                    } else if ('-' == v) {
                        gender = 0;
                    }
                    if (year < 1 || year > 9999) {
                        return;
                    }
                    if (month >= 0 && (month < 1 || month > 12)) {
                        return;
                    }
                    if (month < 0 && (month < -12 || month > -1)) {
                        return;
                    }
                    if (day < 1 || day > 30) {
                        return;
                    }
                    if (hour < 0 || hour > 23) {
                        return;
                    }
                    if (minute < 0 || minute > 59) {
                        return;
                    }
                    computeLunar(year, month, day, hour, minute, gender);
                } else {
                    var year = parseInt(v.substr(0, 4));
                    v = trim(v.substr(4));
                    var month = parseInt(v.substr(0, 2), 10);
                    v = trim(v.substr(2));
                    var day = parseInt(v.substr(0, 2), 10);
                    v = trim(v.substr(2));
                    var hour = parseInt(v.substr(0, 2), 10);
                    v = trim(v.substr(2));
                    var minute = parseInt(v.substr(0, 2), 10);
                    v = trim(v.substr(2));
                    var gender = -1;
                    if ('+' == v) {
                        gender = 1;
                    } else if ('-' == v) {
                        gender = 0;
                    }
                    if (year < 1 || year > 9999) {
                        return;
                    }
                    if (month < 1 || month > 12) {
                        return;
                    }
                    if (day < 1 || day > 31) {
                        return;
                    }
                    if (hour < 0 || hour > 23) {
                        return;
                    }
                    if (minute < 0 || minute > 59) {
                        return;
                    }
                    computeSolar(year, month, day, hour, minute, gender);
                }
            };

            // 触发运算
            //input.oninput = onInput;
            //locationAddress.oninput = onInput; //by dachuan 
            //input.onpropertychange = onInput;
            go_btn.onclick = onInput; // by dachuan
            genderMan.onclick = onChangeGender;
            genderWoman.onclick = onChangeGender;
            zi0.onclick = onChangeZi;
            zi1.onclick = onChangeZi;
            lunarCheck.onclick = onChangeLunar;
        })(window, document);
    </script>
</body>

</html>
